# getSoundPosition (Shared)

> Returns the point in the track the sound is playing.

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

## Syntax

```lua
float|false getSoundPosition(sound sound)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `sound` | `sound` | The `sound` element. On the client a `dui` element also works, for the browser's sound. |

## Returns

The position in seconds, or `false` if the sound was not found.

On the server, the position is worked out from the time that has passed, and wraps back to the start when the sound loops.

## Example

```lua
local music = playSound("sounds/track.mp3")

addEventHandler("onClientRender", root, function()
    local now = getSoundPosition(music) or 0
    local total = getSoundLength(music) or 1
    dxDrawRectangle(20, 20, 200 * now / total, 6, tocolor(255, 255, 255))
end)
```

### Note

This is the playback position, not the position in the world. For that, use `getElementPosition`.

## See also

- [setSoundPosition (Shared)](https://wiki.mymp.gg/en/setSoundPosition.md): Jumps to a point in the track. The value is kept between 0 and the sound's length. On the server, the change is sent to every client.
- [getSoundLength (Shared)](https://wiki.mymp.gg/en/getSoundLength.md): Returns the sound's length.
- [isSoundPaused (Shared)](https://wiki.mymp.gg/en/isSoundPaused.md): Tells whether a sound is paused.
