M MY Multiplayer: Wiki
Side
Kind

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

NameTypeDescription
soundsoundThe 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.

See also