stopSound
Client
Stops a sound this client created and destroys the element. Fires onClientSoundStopped with the reason destroyed.
Also exists on the server, with its own implementation: stopSound
bool stopSound(sound sound)
Parameters
| Name | Type | Description |
|---|---|---|
| sound | sound | The sound element. |
Returns
true if the sound was stopped, false if it came from the server.
Example
local music = playSound("sounds/menu.ogg", true)
addCommandHandler("stopmusic", function()
if isElement(music) then
stopSound(music)
end
end)NoteA sound the server created can only be stopped by the server.