setSoundMaxDistance
Shared
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.
bool setSoundMaxDistance(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.
On the client, a 3D sound streams out when the camera is more than 40 m beyond this distance.
Example
local siren = playSound3D("sounds/siren.ogg", 1544.0, -1675.5, 13.6, true)
setSoundMaxDistance(siren, 120)