# setSoundPaused (Shared)

> Pauses or resumes a sound. On the server, the change is sent to every client.

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

## Syntax

```lua
bool setSoundPaused(sound sound, bool paused)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `sound` | `sound` | The `sound` element. On the client a `dui` element also works, for the browser's sound. |
| `paused` | `bool` | `true` to pause, `false` to resume. |

## Returns

`true` if the sound was found, `false` otherwise.

On the client, when the state changes, it fires `onClientSoundStopped` with `paused` or `onClientSoundStarted` with `resumed`.

## Example

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

bindKey("m", "down", function()
    setSoundPaused(music, not isSoundPaused(music))
end)
```

## See also

- [isSoundPaused (Shared)](https://wiki.mymp.gg/en/isSoundPaused.md): Tells whether a sound is paused.
- [onClientSoundStopped (Client)](https://wiki.mymp.gg/en/onClientSoundStopped.md): Fired when a sound stops playing on this client: paused, stopped or finished.
- [onClientSoundStarted (Client)](https://wiki.mymp.gg/en/onClientSoundStarted.md): Fired when a sound starts playing on this client or leaves a pause.
