# stopSound (Client)

> Stops a sound this client created and destroys the element. Fires `onClientSoundStopped` with the reason `destroyed`.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Sound
- **URL**: https://wiki.mymp.gg/en/stopSound-client
- **Counterpart**: Also exists on the server, with its own implementation: [stopSound (Server)](https://wiki.mymp.gg/en/stopSound-server.md)

## Syntax

```lua
bool stopSound(sound sound)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `sound` | `sound` | The `sound` element. |

## Returns

`true` if the sound was stopped, `false` if it came from the server.

## Example

```lua
local music = playSound("sounds/menu.ogg", true)

addCommandHandler("stopmusic", function()
    if isElement(music) then
        stopSound(music)
    end
end)
```

### Note

A sound the server created can only be stopped by the server.

## See also

- [playSound (Client)](https://wiki.mymp.gg/en/playSound-client.md): Plays a sound with no position in the world, on this client only. Fires onClientSoundStarted with the reason play.
- [setSoundPaused (Shared)](https://wiki.mymp.gg/en/setSoundPaused.md): Pauses or resumes a sound. On the server, the change is sent to every client.
- [stopSound (Server)](https://wiki.mymp.gg/en/stopSound-server.md): Stops a sound the server created and destroys the element on every client.
- [onClientSoundStopped (Client)](https://wiki.mymp.gg/en/onClientSoundStopped.md): Fired when a sound stops playing on this client: paused, stopped or finished.
