# setElementDimension (Shared)

> Changes the dimension of an element and of all its children.

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

## Syntax

```lua
bool setElementDimension(element element, int dimension)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The player, ped, vehicle, object, colshape, sound, effect, light or element made with `createElement`. |
| `dimension` | `int` | Dimension, an integer from 0 to 65535. |

## Returns

`true` if it applied to the element itself, `false` if its type has no dimension. Raises an error if `dimension` is outside 0 to 65535.

When the dimension changes, it fires `onElementDimensionChange` (on the server) or `onClientElementDimensionChange` (on a client).

## Example

```lua
addCommandHandler("private", function(player)
    setElementDimension(player, 1)
end)
```

## See also

- [getElementDimension (Shared)](https://wiki.mymp.gg/en/getElementDimension.md): Reads an element's dimension, from 0 to 65535.
- [setElementInterior (Shared)](https://wiki.mymp.gg/en/setElementInterior.md): Changes an element's interior.
- [onElementDimensionChange (Server)](https://wiki.mymp.gg/en/onElementDimensionChange.md): Fired after an element moves to another dimension. It does not fire when the dimension stays the same.
