Skip to content

KitStdAudio

Audio utilities.

function KitStdAudio.inferAndPlaySound(
instance: Instance,
defaultSound: string?,
searchFor: string?,
config: types.PlaySoundConfig?,
spatial: boolean?
): ()

Tries to infer a sound from the instance’s attributes or a Sound instance. If no sound is found, plays the specified default sound. Can specify the name of the attribute or child to search for, or defaults to searching for “Sound”.

prelude.inferAndPlaySound(btn, std.SOUND_ASSETS.button, "PressSound")

function KitStdAudio.playSound(
asset: string | Sound,
from: Instance?,
config: types.PlaySoundConfig?
): ()

Plays a sound from an asset string or cloned from a Sound instance.


function KitStdAudio.playSoundFromGameAssets(
key: string,
from: Instance?,
config: types.PlaySoundConfig?
): ()

Plays a sound from the game’s assets module. See the sounds table in the Replicated.WTHShared.assets module for what sounds can be played.