KitStdAudio
Audio utilities.
Functions
Section titled “Functions”inferAndPlaySound
Section titled “inferAndPlaySound”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")
Parameters
Section titled “Parameters”instance : Instance
Section titled “instance : Instance”defaultSound : string?
Section titled “defaultSound : string?”searchFor : string?
Section titled “searchFor : string?”config : types.PlaySoundConfig?
Section titled “config : types.PlaySoundConfig?”spatial : boolean?
Section titled “spatial : boolean?”playSound
Section titled “playSound”function KitStdAudio.playSound( asset: string | Sound, from: Instance?, config: types.PlaySoundConfig?): ()
Plays a sound from an asset string or cloned from a Sound instance.
Parameters
Section titled “Parameters”asset : string | Sound
Section titled “asset : string | Sound”from : Instance?
Section titled “from : Instance?”config : types.PlaySoundConfig?
Section titled “config : types.PlaySoundConfig?”playSoundFromGameAssets
Section titled “playSoundFromGameAssets”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.