Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
Sound
Inherits from: Instance → Object
Sound is an object that emits sound. When placed in a BasePart or an Attachment, this object will emit its sound from that part's BasePart.Position or the attachment's Attachment.WorldPosition. In this placement, 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. Additionally, its volume 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, see 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.
Inherits from: Instance
Memory category: Internal
Code samples: View on Creator Hub (Sound-3D-Parent).
Properties
| Name | Type / Returns | Description |
|---|---|---|
| Sound.AudioContent | Content | A reference to an audio asset. |
| Sound.EmitterSize | float | The minimum distance, in studs, at which a 3D Sound (direct child of a BasePart or Attachment) will begin to attenuate (decrease in volume). |
| Sound.IsLoaded | boolean | This property is true when the Sound has loaded from Roblox servers and is ready to play. |
| Sound.IsPaused | boolean | Read-only property which returns true when the Sound is not playing. |
| Sound.IsPlaying | boolean | Read-only property which returns true when the Sound is playing. |
| Sound.isPlaying | boolean | |
| Sound.Looped | boolean | Sets whether or not the Sound repeats once it has finished playing. |
| Sound.LoopRegion | NumberRange | A range denoting a desired loop start and loop end within the PlaybackRegion, in seconds. |
| Sound.MaxDistance | float | The maximum distance, in studs, 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). |
| Sound.MinDistance | float | The minimum distance at which a 3D Sound (direct child of a BasePart or Attachment) will begin to attenuate. Effectively, the emitter size. |
| Sound.Pitch | float | Sets how high pitched and fast a Sound is when it is played. The greater the integer, the higher and faster the Sound is. |
| Sound.PlaybackLoudness | double | A number between 0 and 1000 indicating how loud the Sound is currently playing back. |
| Sound.PlaybackRegion | NumberRange | A range denoting a desired start and stop time within the TimeLength, in seconds. |
| Sound.PlaybackRegionsEnabled | boolean | If true, this property gives your Sound access to the PlaybackRegion and LoopRegion properties which can more-accurately control its playback. |
| Sound.PlaybackSpeed | float | Determines the speed at which a Sound will play, with higher values causing the sound to play faster and at a higher pitch. |
| Sound.Playing | boolean | Indicates whether the Sound is currently playing. |
| Sound.PlayOnRemove | boolean | When true, the Sound will play when it is removed from the experience. |
| Sound.RollOffMaxDistance | float | The maximum distance, in studs, a client's listener can be from the sound's origin and still hear it. Only applies to Sounds parented to a BasePart or Attachment. |
| Sound.RollOffMinDistance | float | The minimum distance, in studs, at which a Sound which is parented to a BasePart or Attachment will begin to attenuate (decrease in volume). |
| Sound.RollOffMode | RollOffMode | Controls how the volume of a Sound which is parented to a BasePart or Attachment attenuates (fades out) as the distance between the listener and parent changes. |
| Sound.SoundGroup | SoundGroup | The SoundGroup that is linked to this Sound. |
| Sound.SoundId | ContentId | Content ID of the sound file to associate with the Sound. |
| Sound.TimeLength | double | The length of the Sound in seconds. |
| Sound.TimePosition | double | Progress of the Sound in seconds. Can be changed to move the playback position of the Sound both before and during playback. |
| Sound.Volume | float | The volume of the Sound. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.Archivable | boolean | Determines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published. |
| Instance.archivable | boolean | |
| Instance.Capabilities | SecurityCapabilities | The set of capabilities allowed to be used for scripts inside this container. |
| Instance.IsInSandbox | boolean | Indicates whether the instance is inside a sandboxed container. |
| Instance.Name | string | A non-unique identifier of the Instance. |
| Instance.Parent | Instance | Determines the hierarchical parent of the Instance. |
| Instance.PredictionMode | PredictionMode | Reflects the client-side prediction mode applied to the instance under server-authoritative physics. |
| Instance.RobloxLocked | boolean | A deprecated property that used to protect CoreGui objects. |
| Instance.Sandboxed | boolean | When enabled, the instance can only access abilities in its Capabilities list. |
| Instance.UniqueId | UniqueId | A unique identifier for the instance. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |
Sound.AudioContent
This property is a reference to an audio asset.
| Field | Value |
|---|---|
| type | Content |
| tags | ["Hidden"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Asset |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.EmitterSize
Deprecated. This property has deprecated in favor of Sound.RollOffMinDistance and Sound.RollOffMaxDistance which should be used instead in new work.
The minimum distance, in studs, at which a 3D Sound (direct child of a BasePart or Attachment) will begin to attenuate (decrease in volume).
Sounds parented to a BasePart or Attachment that are descendants of the Workspace are considered 3D sounds and their volume while playing is dependent on the distance between the client's sound listener (Camera position by default) and the Sound's parent. Two properties influence this behavior EmitterSize and Sound.RollOffMode.
The way the Sound attenuates (fades out) after the distance between the listener and the sound exceeds the EmitterSize is determined by RollOffMode.
| Field | Value |
|---|---|
| type | float |
| tags | ["Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":false} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-3D-Parent).
Sound.IsLoaded
This property is true when the Sound has loaded from Roblox servers and is ready to play. You can use this property and the Loaded event to verify a sound has loaded before playing it.
| Field | Value |
|---|---|
| type | boolean |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Asset |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Loaded).
Sound.IsPaused
This read-only property returns true when the Sound is not playing. Note that it can return true if a sound has been paused using Pause(), if it has been stopped using Stop(), or the sound has never been played.
As IsPaused is read-only, it cannot be used to stop the sound; Stop() or Pause() should be used instead.
| Field | Value |
|---|---|
| type | boolean |
| tags | ["Hidden","ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-IsPlaying-IsPaused).
Sound.IsPlaying
This read-only property returns true when the Sound is playing.
As IsPlaying is read-only, it cannot be used to play the sound; Play() should be used instead.
| Field | Value |
|---|---|
| type | boolean |
| tags | ["Hidden","ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-IsPlaying-IsPaused).
Sound.isPlaying
Deprecated. This deprecated property is a variant of Sound.IsPlaying which should be used instead.
| Field | Value |
|---|---|
| type | boolean |
| tags | ["ReadOnly","NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["LegacySound"] |
Sound.Looped
This sets whether or not the Sound repeats once it has finished playing. Looped sounds are suitable for a range of applications including music and background ambient sounds.
The DidLoop event can be used to track the number of times as sound has looped.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Looping-2).
Sound.LoopRegion
A range denoting a desired loop start and loop end within the PlaybackRegion, in seconds.
If
LoopRegion.Min>PlaybackRegion.Min, the loop starts fromLoopRegion.Min.If
LoopRegion.Min<PlaybackRegion.Min, the loop starts fromPlaybackRegion.Min.If
LoopRegion.Max>PlaybackRegion.Max, the loop starts atPlaybackRegion.Max.If
LoopRegion.Max<PlaybackRegion.Max, the loop starts at exactly that time.If
LoopRegion.Min==LoopRegion.Max, theSounduses thePlaybackRegionproperty instead.
| Field | Value |
|---|---|
| type | NumberRange |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Regions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.MaxDistance
Deprecated. This property has deprecated in favor of Sound.RollOffMinDistance and Sound.RollOffMaxDistance which should be used instead in new work.
The maximum distance, in studs, a client's listener can be from the Sound origin and still hear it. Only applies to Sounds parented to a Part or Attachment (3D sounds).
How MaxDistance impacts the attenuation of a sound (manner in which it fades out) is dependent on the Sound.RollOffMode property. When RollOffMode is set to use an inverse type distance model (Inverse or InverseTapered) the MaxDistance will not effect the attenuation of the sound. This means that low values for MaxDistance will cause the sound to abruptly cut off when the listener reaches the MaxDistance. In most cases this is not desirable and developers are advised not to use low MaxDistance values.
When RollOffMode is set to a linear type distance model (Linear or LinearSquared) the sound will attenuate between Sound.EmitterSize and MaxDistance (with playback volume reaching zero at MaxDistance). This is less realistic, but in some cases allows attenuation to be handled in a more intuitive way.
| Field | Value |
|---|---|
| type | float |
| tags | ["Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-MaxDistance).
Sound.MinDistance
Deprecated. MinDistance has been superseded by Sound.EmitterSize, whose name better describes this properties behavior.
The minimum distance at which a 3D Sound (direct child of a BasePart or Attachment) will begin to attenuate. Effectively, the emitter size.
| Field | Value |
|---|---|
| type | float |
| tags | ["Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":false} |
| capabilities | ["LegacySound"] |
Sound.Pitch
Deprecated. This property has been deprecated in favor of Sound.PlaybackSpeed whose name suits the behavior better.
Sets how high pitched and fast a Sound is when it is played. The greater the integer, the higher and faster the sound is.
| Field | Value |
|---|---|
| type | float |
| tags | ["Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":false} |
| capabilities | ["LegacySound"] |
Sound.PlaybackLoudness
A number between 0 and 1000 indicating how loud the Sound is currently playing back. This property reflects the amplitude of the sound's playback in the instance of time it is read.
| Field | Value |
|---|---|
| type | double |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-PlaybackLoudness).
Sound.PlaybackRegion
A range denoting a desired start and stop time within the TimeLength, in seconds.
If
PlaybackRegion.Min>0, the sound begins to play from thePlaybackRegion.Mintime.If
PlaybackRegion.Min<0, the sound begins to play from0.If
PlaybackRegion.Max>Sound.TimeLength, the sound stops atSound.TimeLength.If
PlaybackRegion.Max<Sound.TimeLength, the sound stops at exactly that time.If
PlaybackRegion.Min==PlaybackRegion.Max, this property is inactive.
| Field | Value |
|---|---|
| type | NumberRange |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Regions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.PlaybackRegionsEnabled
If true, this property gives your Sound access to the PlaybackRegion and LoopRegion properties which can more-accurately control its playback.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.PlaybackSpeed
Determines the speed at which a Sound will play, with higher values causing the sound to play faster and at a higher pitch.
| Field | Value |
|---|---|
| type | float |
| tags | ["NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-PlaybackSpeed).
Sound.Playing
Indicates whether the Sound is currently playing. This can be toggled, and this property will always replicate.
In Studio's Properties window, while in Edit mode, toggling Playing to true does not begin playing the sound, but the sound will begin playing during runtime.
This property should not be confused with IsPlaying which is a read-only property.
Note that when Playing is set to false, the TimePosition property of the sound will not reset, meaning that when Playing is set to true again, the audio will continue from the time position it was at when it was stopped. However, if the Play() function is used to resume the sound, the time position will reset to 0.
| Field | Value |
|---|---|
| type | boolean |
| tags | ["NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Playing).
Sound.PlayOnRemove
When true, the Sound will play when it is removed from the experience by parenting the Sound or one if its ancestors to nil. This means all of the following will cause the sound to play when PlayOnRemove is true:
sound:Destroy()sound.Parent = nilsound.Parent.Parent = nil
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.RollOffMaxDistance
The maximum distance, in studs, a client's listener can be from the sound's origin and still hear it. Only applies to Sounds parented to a BasePart or Attachment.
How RollOffMaxDistance impacts the attenuation of a sound (manner in which it fades out) is dependent on the RollOffMode property.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Emitter |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.RollOffMinDistance
The minimum distance, in studs, at which a Sound which is parented to a BasePart or Attachment will begin to attenuate (decrease in volume).
How RollOffMinDistance impacts the attenuation of a sound (manner in which it fades out) is dependent on the RollOffMode property.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Emitter |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.RollOffMode
This property controls how the volume of a Sound which is parented to a BasePart or Attachment attenuates (fades out) as the distance between the listener and parent changes.
For details on the different modes, see RollOffMode.
| Field | Value |
|---|---|
| type | RollOffMode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Emitter |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.SoundGroup
The SoundGroup that is linked to this Sound.
| Field | Value |
|---|---|
| type | SoundGroup |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Routing |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.SoundId
This property is the content ID of the sound file to associate with the Sound. See Audio Assets for more information.
| Field | Value |
|---|---|
| type | ContentId |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Asset |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Sound.TimeLength
The length of the Sound in seconds. If the Sound is not loaded, this value will be 0.
This property is often used in conjunction with PlaybackSpeed to adjust the speed of a sound so that it lasts for a specific duration.
| Field | Value |
|---|---|
| type | double |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Asset |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-PlaybackSpeed-TimeLength).
Sound.TimePosition
This property reflects the progress of the Sound in seconds. It can be changed to move the playback position of the sound both before and during playback.
As a Sound is played, TimePosition increases at a rate of PlaybackSpeed per second. Once TimePosition reaches TimeLength, the sound will stop unless it is Looped.
Note that setting TimePosition to a value greater than the length in a looped track will not cause it to wrap around. If that behavior is desired, consider the following code snippet:
| Field | Value |
|---|---|
| type | double |
| tags | ["NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-TimePosition, Sound-TimePosition-2).
Sound.Volume
The volume of the Sound. Can be set between 0 and 10 and defaults to 0.5.
Note that if the Sound is a member of a SoundGroup, its playback volume (but not its Volume property) will be influenced by the group's SoundGroup.Volume property.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Playback |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["LegacySound"] |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| Sound:Pause | () | Pauses playback of the Sound if it is playing. |
| Sound:pause | () | |
| Sound:Play | () | Plays the Sound. |
| Sound:play | () | |
| Sound:Resume | () | Resumes the Sound. |
| Sound:Stop | () | Stops the Sound. |
| Sound:stop | () |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance:AddTag | () | Applies a tag to the instance. |
| Instance:children | Instances | Returns an array of the object's children. |
| Instance:ClearAllChildren | () | This method destroys all of an instance's children. |
| Instance:Clone | Instance | Create a copy of an instance and all its descendants, ignoring instances that are not Archivable. |
| Instance:clone | Instance | |
| Instance:Destroy | () | Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. |
| Instance:destroy | () | |
| Instance:FindFirstAncestor | Instance? | Returns the first ancestor of the Instance whose Instance.Name is equal to the given name. |
| Instance:FindFirstAncestorOfClass | Instance? | Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className. |
| Instance:FindFirstAncestorWhichIsA | Instance? | Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstChild | Instance? | Returns the first child of the Instance found with the given name. |
| Instance:findFirstChild | Instance | |
| Instance:FindFirstChildOfClass | Instance? | Returns the first child of the Instance whose ClassName is equal to the given class name. |
| Instance:FindFirstChildWhichIsA | Instance? | Returns the first child of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstDescendant | Instance? | Returns the first descendant found with the given Instance.Name. |
| Instance:GetActor | Actor? | Returns the Actor associated with the Instance, if any. |
| Instance:GetAttribute | Variant | Returns the value which has been assigned to the given attribute name. |
| Instance:GetAttributeChangedSignal | RBXScriptSignal | Returns an event that fires when the given attribute changes. |
| Instance:GetAttributes | Dictionary | Returns a dictionary of the instance's attributes. |
| Instance:GetChildren | Instances | Returns an array containing all of the instance's children. |
| Instance:getChildren | Instances | |
| Instance:GetDebugId | string | Returns a coded string of the debug ID used internally by Roblox. |
| Instance:GetDescendants | Instances | Returns an array containing all of the descendants of the instance. |
| Instance:GetFullName | string | Returns a string describing the instance's ancestry. |
| Instance:GetStyled | Variant | Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. |
| Instance:GetStyledPropertyChangedSignal | RBXScriptSignal | Returns an event that fires when the given style property changes on the instance. |
| Instance:GetTags | Array | Gets an array of all tags applied to the instance. |
| Instance:HasTag | boolean | Check whether the instance has a given tag. |
| Instance:IsAncestorOf | boolean | Returns true if an Instance is an ancestor of the given descendant. |
| Instance:IsDescendantOf | boolean | Returns true if an Instance is a descendant of the given ancestor. |
| Instance:isDescendantOf | boolean | |
| Instance:IsPropertyModified | boolean | Returns true if the value stored in the specified property is not equal to the code-instantiated default. |
| Instance:QueryDescendants | Instances | Returns an array containing all descendants of the instance that match the selector string. |
| Instance:Remove | () | Sets the object's Parent to nil, and does the same for all its descendants. |
| Instance:remove | () | |
| Instance:RemoveTag | () | Removes a tag from the instance. |
| Instance:ResetPropertyToDefault | () | Resets a property to its default value. |
| Instance:SetAttribute | () | Sets the attribute with the given name to the given value. |
| Instance:WaitForChild | Instance | 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. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
Sound:Pause
This method pauses playback of the Sound if it is playing, setting Playing to false. Unlike Stop(), it does not reset TimePosition, meaning the sound can be resumed using Resume().
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).
Sound:pause
Deprecated. This deprecated function is a variant of Sound:Pause() which should be used instead.
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["LegacySound"] |
Sound:Play
This method plays the Sound and sets TimePosition to the last value set by a script (or 0 if it has not been set), then sets Playing to true.
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).
Sound:play
Deprecated. This deprecated function is a variant of Sound:Play() which should be used instead.
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["LegacySound"] |
Sound:Resume
This method resumes the Sound and sets Playing to true. Does not alter TimePosition and thus can be used to resume playback of a sound paused through Pause().
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).
Sound:Stop
This method stops the Sound and sets Playing to false, then sets TimePosition to 0.
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).
Sound:stop
Deprecated. This deprecated function is a variant of Sound:Stop() which should be used instead.
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["LegacySound"] |
Events
| Name | Type / Returns | Description |
|---|---|---|
| Sound.DidLoop | Fires whenever the Sound loops. | |
| Sound.Ended | Fires when the Sound has completed playback and stopped. | |
| Sound.Loaded | Fires when the Sound is loaded. | |
| Sound.Paused | Fires whenever the Sound is paused using Pause(). | |
| Sound.Played | Fires whenever the Sound is played using Play(). | |
| Sound.Resumed | Fires when the Sound is resumed using Resume(). | |
| Sound.Stopped | Fires when the Sound is stopped through using Stop(). |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.AncestryChanged | Fires when the Instance.Parent property of this object or one of its ancestors is changed. | |
| Instance.AttributeChanged | Fires whenever an attribute is changed on the Instance. | |
| Instance.ChildAdded | Fires after an object is parented to this Instance. | |
| Instance.childAdded | ||
| Instance.ChildRemoved | Fires after a child is removed from this Instance. | |
| Instance.DescendantAdded | Fires after a descendant is added to the Instance. | |
| Instance.DescendantRemoving | Fires immediately before a descendant of the Instance is removed. | |
| Instance.Destroying | Fires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy(). | |
| Instance.StyledPropertiesChanged | Fires whenever any style property is changed on the instance, including when a property is set to nil. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |
Sound.DidLoop
Fires whenever the Sound loops. Returns soundId and numOfTimesLooped, giving the content ID of the sound and the number of times looped respectively.
When the Sound is stopped through Stop(), the looped counter resets meaning the next DidLoop event will return 1 for numOfTimesLooped.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| soundId | string | The SoundId of the Sound that looped. | |
| numOfTimesLooped | int | The number of times the Sound has looped. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Looping-2).
Sound.Ended
Fires when the Sound has completed playback and stopped. This event is often used to destroy a sound when it has completed playback:
sound:Play()
sound.Ended:Wait()
sound:Destroy() Note that this event will not fire for sounds with Looped set to true, as they continue playing upon reaching their end. This event will also not fire when the sound is stopped before playback has completed; for this use the Stopped event.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| soundId | string | The SoundId of the Sound that has ended. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["LegacySound"] |
Sound.Loaded
Fires when the Sound is loaded.
As this event only fires at the time the sound is loaded, it's recommended to check the sound's IsLoaded property prior to connecting to this event.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| soundId | string | The SoundId of the Sound that loaded. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Loaded).
Sound.Paused
Fires whenever the Sound is paused using Pause().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| soundId | string | The SoundId of the Sound that was paused. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).
Sound.Played
Fires whenever the Sound is played using Play(). This event will not fire if the Sound is played due to PlayOnRemove being set to true and the sound being destroyed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| soundId | string | The SoundId of the Sound that was played. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).
Sound.Resumed
Fires when the Sound is resumed using Resume().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| soundId | string | The SoundId of the Sound being resumed. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).
Sound.Stopped
Fires when the Sound is stopped through using Stop(). Destroying a sound while it is playing will not cause this event to fire.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| soundId | string | The SoundId of the Sound that stopped. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["LegacySound"] |
Code samples: View on Creator Hub (Sound-Functions).