Reference API Roblox

Engine API

Website

Related

Reference API Roblox

AudioPlayer

Used to play audio assets.

This class is not browsable. It is not visible in Studio's object browser.
Tags: [NotBrowsable]

Member index 17

HistoryMember
592AssetId: string
592AutoLoad: bool
592IsPlaying: bool
592IsReady: bool
592LoopRegion: NumberRange
592Looping: bool
592PlaybackRegion: NumberRange
592PlaybackSpeed: double
592TimeLength: double
592TimePosition: double
629Volume: float
637GetConnectedWires(pin: string): Objects
588Play(): null
588Stop(): null
616Ended()
616Looped()
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553ClassName: string
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
553className: string
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
486GetChildren(): Objects
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
462GetPropertyChangedSignal(property: string): RBXScriptSignal
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsA(className: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
553children(): Objects
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
553getChildren(): Objects
462isA(className: string): bool
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462Changed(property: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)

Description

AudioPlayer is used to play audio assets. It provides a single Output pin which can be connected to other pins via Wires.

History 32

Members 17

AssetId

TypeDefault
string

The asset to be loaded into the AudioPlayer. If AutoLoad is true, the asset loads immediately once this property is assigned. When loading is complete, IsReady becomes true.

History 2

AutoLoad

TypeDefault
booltrue

Controls whether AssetId loads automatically once assigned. If false, the asset will load upon the first attempt to play.

History 2

Ended

Parameters (0)
No parameters.

History 1

GetConnectedWires

Parameters (1)
pinstring
Returns (1)
Objects

History 4

IsPlaying

TypeDefault
boolfalse

Denotes whether this AudioPlayer is currently playing. This property is read-only, but replicates. To play and stop an AudioPlayer at runtime, use the Play() and Stop() methods.

History 2

IsReady

TypeDefault
boolfalse

Denotes whether this AudioPlayer is loaded, buffered, and ready to play. Although uncommon, AudioPlayers may have their assets unloaded at runtime if there is extreme memory pressure, in which case IsReady will become false.

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 2

Tags: [ReadOnly, NotReplicated]

LoopRegion

TypeDefault
NumberRange0 60000

A range, in seconds, denoting a desired loop start and loop end within the PlaybackRegion of this AudioPlayer.

If the LoopRegion minimum is greater than the PlaybackRegion minimum, the loop starts from the LoopRegion minimum.

If the LoopRegion minimum is less than the PlaybackRegion minimum, the loop starts from the PlaybackRegion minimum.

If the LoopRegion maximum is greater than the PlaybackRegion maximum, the loop ends at the PlaybackRegion maximum.

If the LoopRegion maximum is less than the PlaybackRegion maximum, the loop ends at exactly the LoopRegion maximum.

If the LoopRegion minimum equals the LoopRegion maximum, the AudioPlayer uses the PlaybackRegion property instead.

History 2

Looped

Parameters (0)
No parameters.

History 1

Looping

TypeDefault
boolfalse

Controls whether this AudioPlayer loops when exceeding the end of its TimeLength, LoopRegion, or PlaybackRegion.

History 2

Play

Parameters (0)
No parameters.
Returns (1)
null

Plays the AudioPlayer from wherever its TimePosition is. Replicates from server to client.

History 1

PlaybackRegion

TypeDefault
NumberRange0 60000

Range in seconds denoting a desired start time (minimum) and stop time (maximum) within the TimeLength.

If the PlaybackRegion minimum is greater than 0, the sound begins playing from the PlaybackRegion minimum time.

If the PlaybackRegion minimum is less than 0, the sound begins playing from 0.

If the PlaybackRegion maximum is greater than the TimeLength, the sound stops at TimeLength.

If the PlaybackRegion maximum is less than the TimeLength, the sound stops at exactly the PlaybackRegion maximum.

If the PlaybackRegion minimum equals the PlaybackRegion maximum, the sound plays in its entirety.

History 2

PlaybackSpeed

TypeDefault
double1

Multiplier controlling how quickly the asset will be played, directly controlling its perceived pitch. Ranges from 0 to 20.

History 2

Stop

Parameters (0)
No parameters.
Returns (1)
null

Stops the AudioPlayer wherever its TimePosition is. Replicates from server to client.

History 1

TimeLength

TypeDefault
double0

Denotes the length of the loaded AssetId in seconds.

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 2

Tags: [ReadOnly, NotReplicated]

TimePosition

TypeDefault
double0

Tracks and controls the current position of the playhead within the AssetId, in seconds.

History 2

Volume

TypeDefault
float1

Volume level which is multiplied onto the output audio stream, controlling how loudly the asset will be played. Ranges from 0 to 3.

History 1

Settings