# createColSphere (Shared)

> Creates a spherical collision shape.

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

## Syntax

```lua
element|false createColSphere(float x, y, z, float radius)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `x, y, z` | `float` | The sphere's centre. A `vec3` also works. |
| `radius` | `float` | The radius in metres. |

## Returns

The created `colshape` element, or `false` if it could not be created.

A collision shape detects players, peds, vehicles and objects by their position and fires `onColShapeHit` and `onColShapeLeave` (`onClientColShapeHit` and `onClientColShapeLeave` on a client). It goes away when the resource that created it stops.

## Example

```lua
local pickup = createColSphere(2488.0, -1666.0, 13.3, 1.5)
```

## See also

- [createColCircle (Shared)](https://wiki.mymp.gg/en/createColCircle.md): Creates a circular collision shape with no height limit.
- [createColTube (Shared)](https://wiki.mymp.gg/en/createColTube.md): Creates a collision shape shaped like an upright cylinder.
- [onColShapeHit (Server)](https://wiki.mymp.gg/en/onColShapeHit.md): Fired when a player, ped, vehicle or object enters a collision shape.
