Skip to main content

Sounds

Contains functions to play audio clips.

info

This module can only be used in Entity scripts.

Functions

play(target, clipName, asyncMode)

Plays the specified audio clip on a given player(s) device.

Parameters

  • target Either the target Player, client ID of the target player, or Players.All to target all players.
  • clipName The name of the audio clip to play.
  • asyncMode The AsyncMode which determines whether the task should wait for the function to complete before continuing.

Example

Play a robotic hello audio clip.

function onStart()
Sounds.play(Players.All, "voice.male.robotic.hello.1")
end

stop(target, clipName)

Stops any active instances of the specified sound, or all sound if -1 is given.

Parameters

  • target Either the target Player, client ID of the target player, or Players.All to target all players.
  • clipName The name of the audio clip to stop. Use '-1' to stop all sounds.

Example

Stop a specific sound for all players.

function onStart()
Sounds.stop(Players.All, "explosion.tiny.4")
end