- Documentation
- Client functions
- setSoundVolume
Function
setSoundVolume
Sets the sound volume. 1 is normal, up to 2 amplifies.
Syntax
bool setSoundVolume(sound theSound, float volume)Arguments
theSoundsound- The sound.
volumefloat- Volume 0-2.
Returns
true on success.
Example
local music = playSound("audio/menu.mp3", true)
local vol = 1
setTimer(function()
vol = vol - 0.1
setSoundVolume(music, math.max(vol, 0))
end, 200, 10)
Notes
Interior and dimension. A 3D sound with setElementInterior or setElementDimension is silent while the player is in another interior or dimension; the set volume comes back when the player enters it.