# getPedAnimationLength (Client)

> Tells the length of the animation the ped is playing, such as one from `setPedAnimation`.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Animations
- **URL**: https://wiki.mymp.gg/en/getPedAnimationLength

## Syntax

```lua
float getPedAnimationLength(ped ped)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player. |

## Returns

The length in seconds, or `-1` if the ped plays no named animation or is streamed out.

## Example

```lua
local length = getPedAnimationLength(localPlayer)
if length > 0 then
    local left = length * (1 - getPedAnimationProgress(localPlayer))
    outputDebugString(("%.1f s left"):format(left))
end
```

## See also

- [getPedAnimationProgress (Client)](https://wiki.mymp.gg/en/getPedAnimationProgress.md): Tells how far along the animation the ped is playing is, such as one from setPedAnimation.
- [getPedAnimation (Client)](https://wiki.mymp.gg/en/getPedAnimation.md): Tells which setPedAnimation animation a ped is playing on this client.
