# stopSound (Server)

> Stops a sound the server created and destroys the element on every client.

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

## Syntax

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

## Parameters

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

## Returns

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

## Example

```lua
local alarm = playSound3D("sounds/alarm.ogg", 1481.0, -1771.3, 18.8, true)

setTimer(function()
    stopSound(alarm)
end, 30000, 1)
```

### Coming from MTA

In MTA, `stopSound` exists on the client only.

## See also

- [playSound (Server)](https://wiki.mymp.gg/en/playSound-server.md): Creates a sound with no position in the world that every client plays together. Changes made to it on the server reach everyone.
- [playSound3D (Server)](https://wiki.mymp.gg/en/playSound3D-server.md): Creates a sound at a position in the world that every client plays together. Changes made to it on the server reach everyone.
- [stopSound (Client)](https://wiki.mymp.gg/en/stopSound-client.md): Stops a sound this client created and destroys the element. Fires onClientSoundStopped with the reason destroyed.
