Skip to main content

playSound

Play a sound and automatically dispose of it when it's done playing.

Syntax

engine.audio.playSound(soundName, options, withId);

Parameters

NameTypeDescription
soundNamestringThe name of the sound to create.
options (optional)SoundOptionsThe options to use for the sound.
withId (optional)stringThe ID of the sound to create.

Returns

Example

const audio = engine.audio.playSound('fire', {
volume: 0.5,
});

audio.play();

Available on: Client