PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Sound

Show deprecated

Sound

Show deprecated

A Sound is an object that emits sound. See Articles/Adding Sounds|Adding Sounds for more info on how to upload a sound file.

2D and 3D Sound

A sound placed in a BasePart or an Attachment will emit its sound from that part’s BasePart/Position or the attachment’s Attachment/WorldPosition. A sound exhibits the Doppler effect, meaning its frequency and pitch varies with the relative motion of whatever attachment or part it is attached to. The volume of the sound will be determined by the distance between the client’s sound listener (by default the Camera position) and the position of the sound’s parent. For more information on this see Sound/RollOffMode.

A sound is considered “global” if it is not parented to a BasePart or an Attachment. In this case, the sound will play at the same volume throughout the entire place.

Sound Replication

Sound playback is not filtered. If a particular client starts playing a sound, all of the other clients will also play it unless SoundService/RespectFilteringEnabled is set to true.

Properties

float

EmitterSize

The minimum distance at which a 3D Sound (direct child of a BasePart or Attachment) will begin to attenuate (decrease in volume).

bool

IsLoaded

[ReadOnly] [NotReplicated]

This property will be true when the Sound has loaded loaded from Roblox servers and is ready to play.

bool

IsPaused

[ReadOnly] [NotReplicated]

This read-only property will return true when the Sound is not playing.

bool

IsPlaying

[ReadOnly] [NotReplicated]

This read-only property will return true when the Sound is playing.

bool

Looped

This sets whether or not the Sound repeats once it has finished when it is playing.

float

MaxDistance

The maximum distance a client’s listener can be from the Sound's origin and still hear it. Only applies to Sounds parented to a Part or Attachment (3D sounds).

bool

PlayOnRemove

When true, the Sound will play when it is removed from the game, by parenting the Sound or one if its ancestors to nil.

double

PlaybackLoudness

[ReadOnly] [NotReplicated]

A number between 0 and 1000 indicating how loud the Sound is currently playing back.

float

PlaybackSpeed

Determines the speed at which a Sound will play, with higher values causing the sound to play faster and at a higher pitch.

bool

Playing

Indicates whether the Sound is currently playing.

RollOffMode

RollOffMode

Controls how the volume of a 3D Sound (parented to a BasePart or Attachment) behaves as the distance between the listener and sound’s parent changes.

SoundGroup

SoundGroup

The SoundGroup that is linked to this Sound. Volume and SoundEffects applied to this sound group will pass onto the sound. A sound can only be in one sound group at a time.

Content

SoundId

This property is the content ID of the sound file a Sound object is associated with. Once a sound has been uploaded to Roblox the content ID can be found in the uploaded sound’s URL.

double

TimeLength

[ReadOnly] [NotReplicated]

The length of the Sound in seconds. If the Sound is not loaded, this value will be 0.

double

TimePosition

Shows the progress in seconds of the Sound. Can be changed to move the playback position of the Sound both before and during playback.

float

Volume

The volume of the Sound. Can be set between 0 and 10. Defaults to 0.5

Inherited from Instance: Show Hide

int

DataCost

[ReadOnly] [NotReplicated]
The cost of saving the instance using data persistence.
Instance

Parent

Determines the hierarchical parent of the `Instance`.
bool

RobloxLocked

If true, the `Instance` and its descendants cannot be indexed or edited by a `Script` or `LocalScript` and will throw an error if it is attempted.
string

ClassName

[ReadOnly] [NotReplicated]
A read-only string representing the class this `Instance` belongs to.
string

Name

A non-unique identifier of the `Instance`.
bool

Archivable

Determines if an `Instance` can be cloned using `/Instance/Clone` or saved to file.

Functions

void

Pause ( )

Sets Sound/Playing to false. This pauses the playback of the Sound if the sound is playing. As Sound/TimePosition is not reset ,when the Sound is resumed it will continue from its previous position.

void

Play ( )

Plays the Sound. Sets Sound/TimePosition to the last value set by a Script (or 0 if it has not been set), and then sets Sound/Playing to true.

void

Resume ( )

Resumes the Sound. Sets Sound/Playing to true. Does not alter Sound/TimePosition and thus can be used to resume the playback of a sound stopped using Sound/Pause.

void

Stop ( )

Stops the Sound. Sets Sound/Playing to false then sets Sound/TimePosition to 0.

Inherited from Instance: Show Hide

RBXScriptSignal

GetPropertyChangedSignal ( string property )

Get an event that fires when a given property of an object changes.
Instance

FindFirstChildWhichIsA ( string className , bool recursive )

Returns the first child of the `Instance` for whom `Instance/IsA` returns true for the given className.
Array

GetDescendants ( )

[CustomLuaState]
Returns an array containing all of the `Instance`'s descendants.
bool

IsAncestorOf ( Instance descendant )

Returns true if an `Instance` is an ancestor of the given descendant.
bool

IsDescendantOf ( Instance ancestor )

Returns true if an `Instance` is a descendant of the given ancestor.
Instance

FindFirstChildOfClass ( string className )

Returns the first child of the `Instance` whose `Instance/ClassName|ClassName` is equal to the given className.
Instance

FindFirstChild ( string name , bool recursive )

Returns the first child of the `Instance` found with the given name.
Instance

FindFirstAncestorWhichIsA ( string className )

Returns the first ancestor of the `Instance` for whom `Instance/IsA` returns true for the given className.
Instance

FindFirstAncestorOfClass ( string className )

Returns the first ancestor of the `Instance` whose `Instance/ClassName` is equal to the given className.
Instance

FindFirstAncestor ( string name )

Returns the first ancestor of the `Instance` whose `Instance/Name` is equal to the given name.
bool

IsA ( string className )

Returns true if an `Instance`'s class matches or inherits from a given class
Instance

WaitForChild ( string childName , double timeOut )

[CustomLuaState] [CanYield]
Returns the child of the `Instance` with the given name. If the child does not exist, it will yield the current thread until it does.
string

GetFullName ( )

Returns a string showing the `Instance`'s ancestry.
string

GetDebugId ( int scopeLength )

[NotBrowsable]
Returns a coded string of the `Instance`s DebugId used internally by Roblox.
Objects

GetChildren ( )

Returns an array containing all of the `Instance`'s children.
void

Destroy ( )

Sets the `Instance/Parent` property to nil, locks the `Instance/Parent` property, disconnects all connections and calls Destroy on all children.
Instance

Clone ( )

Create a deep copy of a Roblox instance and descendants where `Archivable = true`.
void

ClearAllChildren ( )

This function destroys all of an `Instance`'s children.

Events

RBXScriptSignal

DidLoop ( string soundId , int numOfTimesLooped )

Event that fires whenever the Sound loops. Returns soundId and numOfTimesLooped, giving the contentID of the sound and the number of times looped respectively.

RBXScriptSignal

Ended ( string soundId )

Fires when the Sound has completed playback and stopped.

RBXScriptSignal

Loaded ( string soundId )

Fires when the /Sound is loaded.

RBXScriptSignal

Paused ( string soundId )

Fires whenever the Sound is paused using Sound/Pause.

RBXScriptSignal

Played ( string soundId )

Fires whenever the Sound is played using the Sound/Play function.

RBXScriptSignal

Resumed ( string soundId )

Fires when the Sound is resumed using Sound/Resume.

RBXScriptSignal

Stopped ( string soundId )

Fires when the Sound is stopped due to the Sound/Stop function.

Inherited from Instance: Show Hide

RBXScriptSignal

DescendantRemoving ( Instance descendant )

Fires immediately before a descendant of the `Instance` is removed.
RBXScriptSignal

AncestryChanged ( Instance child , Instance parent )

Fires when the `Instance/Parent` property of the object or one of its ancestors is changed.
RBXScriptSignal

ChildAdded ( Instance child )

Fires when an object is parented to this `Instance`.
RBXScriptSignal

ChildRemoved ( Instance child )

Fires when a child is removed from this `Instance`.
RBXScriptSignal

DescendantAdded ( Instance descendant )

Fires when a descendant is added to the `Instance`.
RBXScriptSignal

Changed ( string property )

Fired immediately after a property of an object changes.