M MY Multiplayer: Wiki
Side
Kind

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.

bool setSoundMinDistance(sound sound, float distance)

Parameters

NameTypeDescription
soundsoundThe sound element. On the client a dui element also works, for the browser's sound.
distancefloatThe 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

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

See also