# onElementDimensionChange (Server)

> Fired after an element moves to another dimension. It does not fire when the dimension stays the same.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Server
- **Category**: Elements
- **URL**: https://wiki.mymp.gg/en/onElementDimensionChange

## Syntax

```lua
addEventHandler("onElementDimensionChange", root, function(int oldDimension, int newDimension) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `oldDimension` | `int` | The previous dimension. |
| `newDimension` | `int` | The new dimension. |

## Source

The element (player, ped, vehicle, object, colshape, sound, effect or element made with `createElement`) that changed dimension.

## Example

```lua
addEventHandler("onElementDimensionChange", root, function(oldDimension, newDimension)
    if getElementType(source) == "player" then
        outputServerLog(getPlayerName(source) .. " went to dimension " .. newDimension)
    end
end)
```

## See also

- [setElementDimension (Shared)](https://wiki.mymp.gg/en/setElementDimension.md): Changes the dimension of an element and of all its children.
- [getElementDimension (Shared)](https://wiki.mymp.gg/en/getElementDimension.md): Reads an element's dimension, from 0 to 65535.
- [onClientElementDimensionChange (Client)](https://wiki.mymp.gg/en/onClientElementDimensionChange.md): Fired after an element moves to another dimension. It does not fire when the dimension stays the same.
