# onColShapeLeave (Server)

> Fired when a player, ped, vehicle or object leaves a collision shape.

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

## Syntax

```lua
addEventHandler("onColShapeLeave", root, function(element hitElement, bool matchingDimension) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `hitElement` | `element` | The element that left. |
| `matchingDimension` | `bool` | Whether the element is in the same dimension as the shape. |

## Source

The collision shape (`colshape`).

## Example

```lua
addEventHandler("onColShapeLeave", zone, function(leftElement, matchingDimension)
    if getElementType(leftElement) == "player" then
        outputDebugString(getPlayerName(leftElement) .. " left the zone")
    end
end)
```

### Note

An element destroyed inside the shape leaves it without firing this event.

## See also

- [onColShapeHit (Server)](https://wiki.mymp.gg/en/onColShapeHit.md): Fired when a player, ped, vehicle or object enters a collision shape.
- [onElementColShapeLeave (Server)](https://wiki.mymp.gg/en/onElementColShapeLeave.md): Fired on a player, ped, vehicle or object when it leaves a collision shape.
- [getElementsWithinColShape (Shared)](https://wiki.mymp.gg/en/getElementsWithinColShape.md): Lists the elements inside a collision shape.
