API:Class/Sound

Sound icon.pngSound : Object Icon.pngInstance

A sound is an object that emits sound. A sound placed in a Part or an Attachment will emit its sound from that part’s Position or the attachment’s 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.

If a sound is global or ambient, then it plays at the same volume throughout the entire place.

Sounds can be uploaded in either .mp3 or .ogg formats. See Sounds for more info on how to upload a sound file.

TimePosition, TimeLength, Playing will all properly replicate when set from the server.

Properties

PropertiesmemberhiddenProperties [toggle]

floatEmitterSize

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

|RMD member="API:Class/Sound/EmitterSize"|The minimum distance at which a 3D Sound (direct child of a Part) will begin to attenuate (decrease in volume).|/RMD|
boolIsLoaded [readonly]

Indicates if the Sound has been loaded.

|RMD member="API:Class/Sound/IsLoaded"|Indicates if the Sound has been loaded.|/RMD|
boolIsPaused [readonly]

This property will return true when the sound is not playing.

|RMD member="API:Class/Sound/IsPaused"|This property will return true when the sound is not playing.|/RMD|
boolIsPlaying [readonly]

This property will return true when the sound is playing.

|RMD member="API:Class/Sound/IsPlaying"|This property will return true when the sound is playing.|/RMD|
boolLooped

This sets whether or not the sound repeats after a script tells it to Play.

|RMD member="API:Class/Sound/Looped"|This sets whether or not the sound repeats after a script tells it to Play.|/RMD|
floatMaxDistance

The maximum distance you can be from the sound's origin to hear it.

|RMD member="API:Class/Sound/MaxDistance"|The maximum distance you can be from the sound's origin to hear it.|/RMD|
boolPlayOnRemove

When true, the sound will play when it is removed from the game.

|RMD member="API:Class/Sound/PlayOnRemove"|When true, the sound will play when it is removed from the game.|/RMD|
doublePlaybackLoudness [readonly]

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

|RMD member="API:Class/Sound/PlaybackLoudness"|A number between 0 and 1000 indicating how loud the sound is currently playing back.|/RMD|
floatPlaybackSpeed

Sets how quickly the sound is played back.

|RMD member="API:Class/Sound/PlaybackSpeed"|Sets how quickly the sound is played back.|/RMD|
boolPlaying

Indicates whether the sound is currently playing. This can be toggled, and this property will always replicate, even with Experimental Mode disabled.

|RMD member="API:Class/Sound/Playing"|Indicates whether the sound is currently playing. This can be toggled, and this property will always replicate, even with Experimental Mode disabled.|/RMD|
RollOffModeRollOffMode

Controls how the volume of a 3D sound behaves as the distance between the listener and sound changes.

|RMD member="API:Class/Sound/RollOffMode"|Controls how the volume of a 3D sound behaves as the distance between the listener and sound changes.|/RMD|
Ref<SoundGroup>SoundGroup

The SoundGroup that is linked to this Sound.

|RMD member="API:Class/Sound/SoundGroup"|The SoundGroup that is linked to this Sound.|/RMD|
ContentSoundId

The URL of the sound asset to play.

|RMD member="API:Class/Sound/SoundId"|The URL of the sound asset to play.|/RMD|
doubleTimeLength [readonly]

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

|RMD member="API:Class/Sound/TimeLength"|The length of the sound in seconds. If the sound is not loaded, this value will be 0.|/RMD|
doubleTimePosition

Shows the progress in seconds of the Sound. Can be changed to move the playback position of the Sound.

|RMD member="API:Class/Sound/TimePosition"|Shows the progress in seconds of the Sound. Can be changed to move the playback position of the Sound.|/RMD|
floatVolume

The volume of the sound. Can be set between 0 and 10.

|RMD member="API:Class/Sound/Volume"|The volume of the sound. Can be set between 0 and 10.|/RMD|
floatMinDistance [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Sound/MinDistance"|Deprecated. Do not use.|/RMD|
floatPitch [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Sound/Pitch"|Deprecated. Do not use.|/RMD|
boolisPlaying [deprecated] [readonly]

Deprecated in favor of IsPlaying.

|RMD member="API:Class/Sound/isPlaying"|Deprecated in favor of IsPlaying.|/RMD|
The minimum distance at which a 3D Sound (direct child of a Part) will begin to attenuate (decrease in volume).
IsLoaded [readonly]
Indicates if the Sound has been loaded.
IsPaused [readonly]
This property will return true when the sound is not playing.
IsPlaying [readonly]
This property will return true when the sound is playing.
This sets whether or not the sound repeats after a script tells it to Play.
The maximum distance you can be from the sound's origin to hear it.
When true, the sound will play when it is removed from the game.
PlaybackLoudness [readonly]
A number between 0 and 1000 indicating how loud the sound is currently playing back.
Sets how quickly the sound is played back.
Indicates whether the sound is currently playing. This can be toggled, and this property will always replicate, even with Experimental Mode disabled.
Controls how the volume of a 3D sound behaves as the distance between the listener and sound changes.
The SoundGroup that is linked to this Sound.
The URL of the sound asset to play.
TimeLength [readonly]
The length of the sound in seconds. If the sound is not loaded, this value will be 0.
Shows the progress in seconds of the Sound. Can be changed to move the playback position of the Sound.
The volume of the sound. Can be set between 0 and 10.
MinDistance [deprecated]
Deprecated. Do not use.
Pitch [deprecated]
Deprecated. Do not use.
isPlaying [deprecated] [readonly]
Deprecated in favor of IsPlaying.
Inherited from Object Icon.pngInstance:
boolArchivable

Determines if an object can be Clone or saved to file.

|RMD member="API:Class/Instance/Archivable"|Determines if an object can be Clone or saved to file.|/RMD|
stringClassName [readonly]

The unique name of this type of Instance.

|RMD member="API:Class/Instance/ClassName"|The unique name of this type of Instance.|/RMD|
stringName

A non-unique identifier for the object.

|RMD member="API:Class/Instance/Name"|A non-unique identifier for the object.|/RMD|
Ref<Instance>Parent

The hierarchical parent of the object.

|RMD member="API:Class/Instance/Parent"|The hierarchical parent of the object.|/RMD|
intDataCost [LocalUserSecurity] [deprecated] [readonly]

Deprecated. Do not use.

|RMD member="API:Class/Instance/DataCost"|Deprecated. Do not use.|/RMD|
boolRobloxLocked [PluginSecurity]

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

|RMD member="API:Class/Instance/RobloxLocked"|If true, the object and its descendants cannot be indexed or edited by a Script or LocalScript and will throw an error if it is attempted.|/RMD|
boolarchivable [deprecated] [hidden]

Deprecated in favor of Archivable.

|RMD member="API:Class/Instance/archivable"|Deprecated in favor of Archivable.|/RMD|
stringclassName [deprecated] [readonly]

Deprecated in favor of ClassName.

|RMD member="API:Class/Instance/className"|Deprecated in favor of ClassName.|/RMD|
Determines if an object can be Clone or saved to file.
ClassName [readonly]
The unique name of this type of Instance.
A non-unique identifier for the object.
The hierarchical parent of the object.
DataCost [LocalUserSecurity] [deprecated] [readonly]
Deprecated. Do not use.
RobloxLocked [PluginSecurity]
If true, the object and its descendants cannot be indexed or edited by a Script or LocalScript and will throw an error if it is attempted.
archivable [deprecated] [hidden]
Deprecated in favor of Archivable.
className [deprecated] [readonly]
Deprecated in favor of ClassName.

Functions

FunctionsmemberhiddenFunctions [toggle]

voidPause ( )

Pauses the Sound if it is playing. Sets Playing to false.

|RMD member="API:Class/Sound/Pause"|Pauses the Sound if it is playing. Sets Playing to false.|/RMD|
voidPlay ( )

Plays the sound. Sets TimePosition to the last value set in lua (default 0), and then sets Playing to true.

|RMD member="API:Class/Sound/Play"|Plays the sound. Sets TimePosition to the last value set in lua (default 0), and then sets Playing to true.|/RMD|
voidResume ( )

Resumes the sound. Sets Playing to True.

|RMD member="API:Class/Sound/Resume"|Resumes the sound. Sets Playing to True.|/RMD|
voidStop ( )

Stops the sound. Sets Playing to false then sets TimePosition to 0.

|RMD member="API:Class/Sound/Stop"|Stops the sound. Sets Playing to false then sets TimePosition to 0.|/RMD|
voidpause ( ) [deprecated]

Deprecated in favor of Pause.

|RMD member="API:Class/Sound/pause"|Deprecated in favor of Pause.|/RMD|
voidplay ( ) [deprecated]

Deprecated in favor of Play.

|RMD member="API:Class/Sound/play"|Deprecated in favor of Play.|/RMD|
voidstop ( ) [deprecated]

Deprecated in favor of Stop.

|RMD member="API:Class/Sound/stop"|Deprecated in favor of Stop.|/RMD|
Pause ( )
Pauses the Sound if it is playing. Sets Playing to false.
Play ( )
Plays the sound. Sets TimePosition to the last value set in lua (default 0), and then sets Playing to true.
Resume ( )
Resumes the sound. Sets Playing to True.
Stop ( )
Stops the sound. Sets Playing to false then sets TimePosition to 0.
pause ( ) [deprecated]
Deprecated in favor of Pause.
play ( ) [deprecated]
Deprecated in favor of Play.
stop ( ) [deprecated]
Deprecated in favor of Stop.
Inherited from Object Icon.pngInstance:
voidClearAllChildren ( )

Removes all descendants of the object.

|RMD member="API:Class/Instance/ClearAllChildren"|Removes all descendants of the object.|/RMD|
Ref<Instance>Clone ( )

Returns a copy of the object, including descendants, but only if the object is Archivable.

|RMD member="API:Class/Instance/Clone"|Returns a copy of the object, including descendants, but only if the object is Archivable.|/RMD|
voidDestroy ( )

Sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children.

|RMD member="API:Class/Instance/Destroy"|Sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children.|/RMD|
Ref<Instance>FindFirstAncestor ( string name )

Returns the first ancestor whose Name is equal to name, or nil if none can be found.

|RMD member="API:Class/Instance/FindFirstAncestor"|Returns the first ancestor whose Name is equal to name, or nil if none can be found.|/RMD|
Ref<Instance>FindFirstAncestorOfClass ( string className )

Returns the first ancestor whose ClassName is equal to className, or nil if none can be found.

|RMD member="API:Class/Instance/FindFirstAncestorOfClass"|Returns the first ancestor whose ClassName is equal to className, or nil if none can be found.|/RMD|
Ref<Instance>FindFirstAncestorWhichIsA ( string className )

Returns the first ancestor that inherits the class className, or nil if none can be found.

|RMD member="API:Class/Instance/FindFirstAncestorWhichIsA"|Returns the first ancestor that inherits the class className, or nil if none can be found.|/RMD|
Ref<Instance>FindFirstChild ( string name, bool recursive = false )

Returns the first child found with the given name, or nil if no such child exists. If the optional recursive argument is true, recursively descends the hierarchy while searching rather than only searching the immediate object.

|RMD member="API:Class/Instance/FindFirstChild"|Returns the first child found with the given name, or nil if no such child exists. If the optional recursive argument is true, recursively descends the hierarchy while searching rather than only searching the immediate object.|/RMD|
Ref<Instance>FindFirstChildOfClass ( string className )

Returns the first Instance whose ClassName is equal to className, or nil, if no such object is found with that ClassName.

|RMD member="API:Class/Instance/FindFirstChildOfClass"|Returns the first Instance whose ClassName is equal to className, or nil, if no such object is found with that ClassName.|/RMD|
Ref<Instance>FindFirstChildWhichIsA ( string className, bool recursive = false )

Returns the first child that inherits the class className, or nil if none can be found.

|RMD member="API:Class/Instance/FindFirstChildWhichIsA"|Returns the first child that inherits the class className, or nil if none can be found.|/RMD|
array<Instance>GetChildren ( )

Returns an array of the object's children.

|RMD member="API:Class/Instance/GetChildren"|Returns an array of the object's children.|/RMD|
array<Instance>GetDescendants ( )

Returns an array containing all of the descendants of the instance.

|RMD member="API:Class/Instance/GetDescendants"|Returns an array containing all of the descendants of the instance.|/RMD|
stringGetFullName ( )

Returns a string which shows the object's ancestry chain.

|RMD member="API:Class/Instance/GetFullName"|Returns a string which shows the object's ancestry chain.|/RMD|
RBXScriptSignalGetPropertyChangedSignal ( string property )

Returns a signal that is fired when the specified property is changed on this object.

|RMD member="API:Class/Instance/GetPropertyChangedSignal"|Returns a signal that is fired when the specified property is changed on this object.|/RMD|
boolIsA ( string className )

Returns true if the object is an instance of the given class, or if the object's class inherits from the given class.

|RMD member="API:Class/Instance/IsA"|Returns true if the object is an instance of the given class, or if the object's class inherits from the given class.|/RMD|
boolIsAncestorOf ( Instance descendant )

Returns true if the object is an ancestor of the given descendant.

|RMD member="API:Class/Instance/IsAncestorOf"|Returns true if the object is an ancestor of the given descendant.|/RMD|
boolIsDescendantOf ( Instance ancestor )

Returns true if the object is a descendant of the given ancestor.

|RMD member="API:Class/Instance/IsDescendantOf"|Returns true if the object is a descendant of the given ancestor.|/RMD|
Ref<Instance>WaitForChild ( string childName, double timeOut )

Yields the current thread until a child with the given name is found, then returns the child. If the timeOut parameter is specified, this function will time out and return nil if timeOut seconds elapse without the child being found.

|RMD member="API:Class/Instance/WaitForChild"|Yields the current thread until a child with the given name is found, then returns the child.

If the timeOut parameter is specified, this function will time out and return nil if timeOut seconds elapse without the child being found.|/RMD|

stringGetDebugId ( int scopeLength = 4 ) [PluginSecurity] [notbrowsable]

Returns a coded string of the object's DebugId used internally by Roblox.

|RMD member="API:Class/Instance/GetDebugId"|Returns a coded string of the object's DebugId used internally by Roblox.|/RMD|
voidRemove ( ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Instance/Remove"|Deprecated. Do not use.|/RMD|
array<Instance>children ( ) [deprecated]

Deprecated in favor of GetChildren.

|RMD member="API:Class/Instance/children"|Deprecated in favor of GetChildren.|/RMD|
Instanceclone ( ) [deprecated]

Deprecated in favor of Clone.

|RMD member="API:Class/Instance/clone"|Deprecated in favor of Clone.|/RMD|
voiddestroy ( ) [deprecated]

Deprecated in favor of Destroy.

|RMD member="API:Class/Instance/destroy"|Deprecated in favor of Destroy.|/RMD|
InstancefindFirstChild ( string name, bool recursive = false ) [deprecated]

Deprecated in favor of FindFirstChild.

|RMD member="API:Class/Instance/findFirstChild"|Deprecated in favor of FindFirstChild.|/RMD|
array<Instance>getChildren ( ) [deprecated]

Deprecated in favor of GetChildren.

|RMD member="API:Class/Instance/getChildren"|Deprecated in favor of GetChildren.|/RMD|
boolisA ( string className ) [deprecated]

Deprecated in favor of IsA.

|RMD member="API:Class/Instance/isA"|Deprecated in favor of IsA.|/RMD|
boolisDescendantOf ( Instance ancestor ) [deprecated]

Deprecated in favor of IsDescendantOf.

|RMD member="API:Class/Instance/isDescendantOf"|Deprecated in favor of IsDescendantOf.|/RMD|
voidremove ( ) [deprecated]

Deprecated in favor of Remove.

|RMD member="API:Class/Instance/remove"|Deprecated in favor of Remove.|/RMD|
Removes all descendants of the object.
Clone ( )
Returns a copy of the object, including descendants, but only if the object is Archivable.
Sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children.
Returns the first ancestor whose Name is equal to name, or nil if none can be found.
Returns the first ancestor whose ClassName is equal to className, or nil if none can be found.
Returns the first ancestor that inherits the class className, or nil if none can be found.
FindFirstChild ( string name, bool recursive = false )
Returns the first child found with the given name, or nil if no such child exists. If the optional recursive argument is true, recursively descends the hierarchy while searching rather than only searching the immediate object.
Returns the first Instance whose ClassName is equal to className, or nil, if no such object is found with that ClassName.
FindFirstChildWhichIsA ( string className, bool recursive = false )
Returns the first child that inherits the class className, or nil if none can be found.
Returns an array of the object's children.
Returns an array containing all of the descendants of the instance.
Returns a string which shows the object's ancestry chain.
Returns a signal that is fired when the specified property is changed on this object.
IsA ( string className )
Returns true if the object is an instance of the given class, or if the object's class inherits from the given class.
IsAncestorOf ( Instance descendant )
Returns true if the object is an ancestor of the given descendant.
Returns true if the object is a descendant of the given ancestor.
WaitForChild ( string childName, double timeOut )
Yields the current thread until a child with the given name is found, then returns the child. If the timeOut parameter is specified, this function will time out and return nil if timeOut seconds elapse without the child being found.
GetDebugId ( int scopeLength = 4 ) [PluginSecurity] [notbrowsable]
Returns a coded string of the object's DebugId used internally by Roblox.
Remove ( ) [deprecated]
Deprecated. Do not use.
children ( ) [deprecated]
Deprecated in favor of GetChildren.
clone ( ) [deprecated]
Deprecated in favor of Clone.
destroy ( ) [deprecated]
Deprecated in favor of Destroy.
findFirstChild ( string name, bool recursive = false ) [deprecated]
Deprecated in favor of FindFirstChild.
getChildren ( ) [deprecated]
Deprecated in favor of GetChildren.
isA ( string className ) [deprecated]
Deprecated in favor of IsA.
isDescendantOf ( Instance ancestor ) [deprecated]
Deprecated in favor of IsDescendantOf.
remove ( ) [deprecated]
Deprecated in favor of Remove.


Events

EventsmemberhiddenEvents [toggle]

DidLoop ( string soundId, int numOfTimesLooped )

Fires whenever this sound loops.

|RMD member="API:Class/Sound/DidLoop"|Fires whenever this sound loops.|/RMD|
Ended ( string soundId )

Fires whenever this sound has ended.

|RMD member="API:Class/Sound/Ended"|Fires whenever this sound has ended.|/RMD|
Loaded ( string soundId )

Fired when the sound is loaded.

|RMD member="API:Class/Sound/Loaded"|Fired when the sound is loaded.|/RMD|
Paused ( string soundId )

Fires whenever this sound is paused.

|RMD member="API:Class/Sound/Paused"|Fires whenever this sound is paused.|/RMD|
Played ( string soundId )

Fires whenever a sound gets played.

|RMD member="API:Class/Sound/Played"|Fires whenever a sound gets played.|/RMD|
Resumed ( string soundId )

Fired when the sound is Resumed.

|RMD member="API:Class/Sound/Resumed"|Fired when the sound is Resumed.|/RMD|
Stopped ( string soundId )

Fires whenever a sound is stopped.

|RMD member="API:Class/Sound/Stopped"|Fires whenever a sound is stopped.|/RMD|
DidLoop ( string soundId, int numOfTimesLooped )
Fires whenever this sound loops.
Ended ( string soundId )
Fires whenever this sound has ended.
Loaded ( string soundId )
Fired when the sound is loaded.
Paused ( string soundId )
Fires whenever this sound is paused.
Played ( string soundId )
Fires whenever a sound gets played.
Resumed ( string soundId )
Fired when the sound is Resumed.
Stopped ( string soundId )
Fires whenever a sound is stopped.
Inherited from Object Icon.pngInstance:
AncestryChanged ( Instance child, Instance parent )

Fires when the Parent property of the object or one of its ancestors is changed.

|RMD member="API:Class/Instance/AncestryChanged"|Fires when the Parent property of the object or one of its ancestors is changed.|/RMD|
Changed ( string property )

Fires after a property of the object changes.

|RMD member="API:Class/Instance/Changed"|Fires after a property of the object changes.|/RMD|
ChildAdded ( Instance child )

Fires when a child is added to the object.

|RMD member="API:Class/Instance/ChildAdded"|Fires when a child is added to the object.|/RMD|
ChildRemoved ( Instance child )

Fires when a child is removed from the object.

|RMD member="API:Class/Instance/ChildRemoved"|Fires when a child is removed from the object.|/RMD|
DescendantAdded ( Instance descendant )

Fires when a descendant is added to the object.

|RMD member="API:Class/Instance/DescendantAdded"|Fires when a descendant is added to the object.|/RMD|
DescendantRemoving ( Instance descendant )

Fires before a descendant of the object is removed.

|RMD member="API:Class/Instance/DescendantRemoving"|Fires before a descendant of the object is removed.|/RMD|
childAdded ( Instance child ) [deprecated]

Deprecated in favor of ChildAdded.

|RMD member="API:Class/Instance/childAdded"|Deprecated in favor of ChildAdded.|/RMD|
Fires when the Parent property of the object or one of its ancestors is changed.
Changed ( string property )
Fires after a property of the object changes.
Fires when a child is added to the object.
Fires when a child is removed from the object.
DescendantAdded ( Instance descendant )
Fires when a descendant is added to the object.
Fires before a descendant of the object is removed.
childAdded ( Instance child ) [deprecated]
Deprecated in favor of ChildAdded.

|RMD member="API:Class/Sound"|A sound is an object that emits sound. A sound placed in a Part or an Attachment will emit its sound from that part’s Position or the attachment’s 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. If a sound is global or ambient, then it plays at the same volume throughout the entire place. Sounds can be uploaded in either .mp3 or .ogg formats. See Sounds for more info on how to upload a sound file. TimePosition, TimeLength, Playing will all properly replicate when set from the server. |/RMD|



See also