# setElementFrozen (Shared)

> Freezes or unfreezes an element and all its children.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Elements
- **URL**: https://wiki.mymp.gg/en/setElementFrozen

## Syntax

```lua
bool setElementFrozen(element element, bool frozen)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The player, ped, vehicle or object. |
| `frozen` | `bool` | `true` to freeze, `false` to release. |

## Returns

`true` if it applied to the element itself, `false` if it is not a player, ped, vehicle or object.

## Example

```lua
addCommandHandler("freeze", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    setElementFrozen(vehicle or player, true)
end)
```

## See also

- [isElementFrozen (Shared)](https://wiki.mymp.gg/en/isElementFrozen.md): Tells whether an element is frozen.
- [setElementVelocity (Shared)](https://wiki.mymp.gg/en/setElementVelocity.md): Sets an element's velocity.
