# getElementVelocity (Shared)

> Returns an element's velocity.

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

## Syntax

```lua
vec3|false getElementVelocity(element element)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The element: a ped, player, vehicle or object. |

## Returns

A `vec3` with the velocity in units per simulation step, or `false` if the element has no velocity.

## Example

```lua
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
    local velocity = getElementVelocity(vehicle)
    local speed = math.sqrt(velocity.x ^ 2 + velocity.y ^ 2 + velocity.z ^ 2)
    outputDebugString(("speed: %.3f"):format(speed))
end
```

## See also

- [setElementVelocity (Shared)](https://wiki.mymp.gg/en/setElementVelocity.md): Sets an element's velocity.
- [getElementAngularVelocity (Shared)](https://wiki.mymp.gg/en/getElementAngularVelocity.md): Reads how fast an element turns about each axis, per simulation step.
- [getElementPosition (Shared)](https://wiki.mymp.gg/en/getElementPosition.md): Reads an element's position in the world.
