M MY Multiplayer: Wiki
Side
Kind

setSoundPaused

Shared

Pauses or resumes a sound. On the server, the change is sent to every client.

bool setSoundPaused(sound sound, bool paused)

Parameters

NameTypeDescription
soundsoundThe sound element. On the client a dui element also works, for the browser's sound.
pausedbooltrue to pause, false to resume.

Returns

true if the sound was found, false otherwise.

On the client, when the state changes, it fires onClientSoundStopped with paused or onClientSoundStarted with resumed.

Example

local music = playSound("sounds/track.mp3", true)

bindKey("m", "down", function()
    setSoundPaused(music, not isSoundPaused(music))
end)

See also