Skip to main content

Audio

Provides functions for interfacing with AudioSources.

To get an AudioSource from an item, use the GetComponent method.

let audioComponent = item.GetComponent("Audio")

You can then use the audioComponent property to access the Audio class.

Methods

Method NameReturn TypeParametersDescription
IsPlayingboolnoneReturns true if the attached AudioSource is playing
IsMutedboolnoneReturns true if the attached AudioSource is muted
IsLoopingboolnoneReturns true if the attached AudioSource is looping
PlayvoidnonePlays the AudioSource
PausevoidnonePauses the AudioSource
ResumevoidnoneResumes the AudioSource
StopvoidnoneStops the AudioSource
SetAudioClipvoidstringSets the AudioSource's clip from Local Script Assets (AudioClip)
SetMutevoidboolSets the mute property of an AudioSource
SetLoopvoidboolSets the loop property of an AudioSource
GetPitchfloatnoneGets the pitch property of an AudioSource
SetPitchvoidfloatSets the pitch property of an AudioSource
GetVolumefloatnoneGets the volume property of an AudioSource
SetVolumevoidfloatSets the volume property of an AudioSource
GetPositionfloatnoneGets the position property of an AudioSource
SetPositionvoidfloatSets the position property of an AudioSource
GetLengthfloatnoneGets the length property of an AudioSource's clip
LoadFromStreamvoidStreamDownload, function()Loads data from a StreamDownload to an AudioSource