# setSoundMinDistance (Shared)

> Sets how far a 3D sound plays at full volume. The default is 5 m. 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/setSoundMinDistance

## Syntax

```lua
bool setSoundMinDistance(sound sound, float distance)
```

## Parameters

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

## Returns

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

Between the min and max distance the volume fades out; beyond the max distance the sound is silent.

## Example

```lua
local radio = playSound3D("sounds/radio.ogg", 2495.1, -1687.4, 13.5, true)
setSoundMinDistance(radio, 10)
setSoundMaxDistance(radio, 50)
```

## See also

- [getSoundMinDistance (Shared)](https://wiki.mymp.gg/en/getSoundMinDistance.md): Returns how far a 3D sound plays at full volume.
- [setSoundMaxDistance (Shared)](https://wiki.mymp.gg/en/setSoundMaxDistance.md): Sets the distance at which a 3D sound goes silent. The default is 20 m. On the server, the change is sent to every client.
- [playSound3D (Client)](https://wiki.mymp.gg/en/playSound3D-client.md): Plays a sound at a position in the world, on this client only. Its volume falls with distance between setSoundMinDistance (5 m) and setSoundMaxDistance (20 m). Fires onClientSoundStarted with play.
