Sound
An object that emits sound. This object can be placed within a BasePart or Attachment to emit a sound from a particular position within a place or world, or it can be attached elsewhere to play the sound at a constant volume throughout the entire place.
Memory category | Internal |
---|
Member index 51
Description
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.
History 203
- 648 Change CanSave of from true to false
- 648 Change Tags of RollOffMinDistance from [NotReplicated] to []
- 648 Change CanSave of RollOffMinDistance from false to true
- 648 Change CanLoad of RollOffMinDistance from false to true
- 648 Change CanLoad of RollOffMaxDistance from false to true
- 648 Change Tags of RollOffMaxDistance from [NotReplicated] to []
- 648 Change CanSave of RollOffMaxDistance from false to true
- 648 Change CanSave of EmitterSize from true to false
- 645 Change ValueType of SoundId from Content to ContentId
- 601 Change PreferredDescriptor of from to RollOffMinDistance
- 601 Change Tags of from [Hidden, NotReplicated, NotScriptable] to [Hidden, NotReplicated, NotScriptable, Deprecated]
- 601 Change Tags of from [Hidden, NotReplicated, NotScriptable] to [Hidden, NotReplicated, NotScriptable, Deprecated]
- 601 Change PreferredDescriptor of from to RollOffMaxDistance
- 601 Change Tags of MinDistance from [] to [Deprecated]
- 601 Change PreferredDescriptor of MinDistance from to RollOffMinDistance
- 601 Change Tags of MaxDistance from [] to [Deprecated]
- 601 Change PreferredDescriptor of MaxDistance from to RollOffMaxDistance
- 601 Change Tags of EmitterSize from [] to [Deprecated]
- 601 Change PreferredDescriptor of EmitterSize from to RollOffMinDistance
- 599 Change Tags of MinDistance from [Deprecated] to []
- 599 Change PreferredDescriptor of MinDistance from RollOffMinDistance to
- 599 Change Tags of MaxDistance from [Deprecated] to []
- 599 Change PreferredDescriptor of MaxDistance from RollOffMaxDistance to
- 599 Change Tags of EmitterSize from [Deprecated] to []
- 599 Change PreferredDescriptor of EmitterSize from RollOffMinDistance to
- 582 Change Tags of PlaybackRegionsEnabled from [NotBrowsable] to []
- 573 Change ReturnType of stop from void to null
- 573 Change ReturnType of play from void to null
- 573 Change ReturnType of pause from void to null
- 573 Change ReturnType of Stop from void to null
- 573 Change ReturnType of Resume from void to null
- 573 Change ReturnType of Play from void to null
- 573 Change ReturnType of Pause from void to null
- 562 Add
- 562 Add
- 553 Add
- 553 Add
- 553 Add
- 553 Add
- 553 Add
- 553 Change PreferredDescriptor of stop from to Stop
- 553 Change PreferredDescriptor of play from to Play
- 553 Change PreferredDescriptor of pause from to Pause
- 553 Add
- 553 Add
- 553 Change Default of isPlaying from to false
- 553 Change PreferredDescriptor of isPlaying from to IsPlaying
- 553 Change Category of Volume from Data to Playback
- 553 Change Default of Volume from to 0.5
- 553 Change Default of from to Default
- 553 Add
- 553 Change Category of TimePosition from Data to Playback
- 553 Change Default of TimePosition from to 0
- 553 Change Category of TimeLength from Data to Asset
- 553 Change Default of TimeLength from to 0
- 553 Change Category of SoundId from Data to Asset
- 553 Change Category of SoundGroup from Data to Routing
- 553 Change Default of SoundGroup from to
- 553 Change Category of RollOffMode from Data to Emitter
- 553 Change Default of RollOffMode from to Inverse
- 553 Change Category of RollOffMinDistance from Data to Emitter
- 553 Change Default of RollOffMinDistance from to 10
- 553 Change Default of RollOffMaxDistance from to 10000
- 553 Change Category of RollOffMaxDistance from Data to Emitter
- 553 Add
- 553 Change Category of Playing from Data to Playback
- 553 Change Default of Playing from to false
- 553 Change Category of PlaybackSpeed from Data to Playback
- 553 Change Default of PlaybackSpeed from to 1
- 553 Change Default of PlaybackRegionsEnabled from to false
- 553 Change Default of PlaybackRegion from to NumberRange(0 60000 )
- 553 Change Default of PlaybackLoudness from to 0
- 553 Change Category of PlaybackLoudness from Data to Playback
- 553 Change Default of PlayOnRemove from to false
- 553 Change PreferredDescriptor of Pitch from to PlaybackSpeed
- 553 Change Default of Pitch from to 1
- 553 Change PreferredDescriptor of MinDistance from to RollOffMinDistance
- 553 Change Default of MinDistance from to 10
- 553 Change PreferredDescriptor of MaxDistance from to RollOffMaxDistance
- 553 Change Default of MaxDistance from to 10000
- 553 Change Category of Looped from Data to Playback
- 553 Change Default of Looped from to false
- 553 Change Default of LoopRegion from to NumberRange(0 60000 )
- 553 Change Tags of from [ReadOnly, NotReplicated] to [Hidden, ReadOnly, NotReplicated]
- 553 Change Default of from to false
- 553 Change Category of from Data to Playback
- 553 Change Category of from Data to Playback
- 553 Change Tags of from [ReadOnly, NotReplicated] to [Hidden, ReadOnly, NotReplicated]
- 553 Change Default of from to true
- 553 Change Category of IsLoaded from Data to Asset
- 553 Change Default of IsLoaded from to false
- 553 Change PreferredDescriptor of EmitterSize from to RollOffMinDistance
- 553 Change Default of EmitterSize from to 10
- 553 Change Category of ChannelCount from Data to Asset
- 553 Change Default of ChannelCount from to 0
- 549 Add PlaybackRegionsEnabled
- 549 Add PlaybackRegion
- 549 Add LoopRegion
- 516 Add
- 491 Add ChannelCount
- 486 Change ThreadSafety of isPlaying from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Volume from ReadOnly to ReadSafe
- 486 Change ThreadSafety of TimePosition from ReadOnly to ReadSafe
- 486 Change ThreadSafety of TimeLength from ReadOnly to ReadSafe
- 486 Change ThreadSafety of SoundId from ReadOnly to ReadSafe
- 486 Change ThreadSafety of SoundGroup from ReadOnly to ReadSafe
- 486 Change ThreadSafety of RollOffMode from ReadOnly to ReadSafe
- 486 Change ThreadSafety of RollOffMinDistance from ReadOnly to ReadSafe
- 486 Change ThreadSafety of RollOffMaxDistance from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Playing from ReadOnly to ReadSafe
- 486 Change ThreadSafety of PlaybackSpeed from ReadOnly to ReadSafe
- 486 Change ThreadSafety of PlaybackLoudness from ReadOnly to ReadSafe
- 486 Change ThreadSafety of PlayOnRemove from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Pitch from ReadOnly to ReadSafe
- 486 Change ThreadSafety of MinDistance from ReadOnly to ReadSafe
- 486 Change ThreadSafety of MaxDistance from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Looped from ReadOnly to ReadSafe
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 486 Change ThreadSafety of IsLoaded from ReadOnly to ReadSafe
- 486 Change ThreadSafety of EmitterSize from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Stopped from to Unsafe
- 462 Change ThreadSafety of Resumed from to Unsafe
- 462 Change ThreadSafety of Played from to Unsafe
- 462 Change ThreadSafety of Paused from to Unsafe
- 462 Change ThreadSafety of Loaded from to Unsafe
- 462 Change ThreadSafety of Ended from to Unsafe
- 462 Change ThreadSafety of DidLoop from to Unsafe
- 462 Change ThreadSafety of stop from to Unsafe
- 462 Change ThreadSafety of play from to Unsafe
- 462 Change ThreadSafety of pause from to Unsafe
- 462 Change ThreadSafety of Stop from to Unsafe
- 462 Change ThreadSafety of Resume from to Unsafe
- 462 Change ThreadSafety of Play from to Unsafe
- 462 Change ThreadSafety of Pause from to Unsafe
- 462 Change ThreadSafety of isPlaying from to ReadOnly
- 462 Change ThreadSafety of Volume from to ReadOnly
- 462 Change ThreadSafety of TimePosition from to ReadOnly
- 462 Change ThreadSafety of TimeLength from to ReadOnly
- 462 Change ThreadSafety of SoundId from to ReadOnly
- 462 Change ThreadSafety of SoundGroup from to ReadOnly
- 462 Change ThreadSafety of RollOffMode from to ReadOnly
- 462 Change ThreadSafety of RollOffMinDistance from to ReadOnly
- 462 Change ThreadSafety of RollOffMaxDistance from to ReadOnly
- 462 Change ThreadSafety of Playing from to ReadOnly
- 462 Change ThreadSafety of PlaybackSpeed from to ReadOnly
- 462 Change ThreadSafety of PlaybackLoudness from to ReadOnly
- 462 Change ThreadSafety of PlayOnRemove from to ReadOnly
- 462 Change ThreadSafety of Pitch from to ReadOnly
- 462 Change ThreadSafety of MinDistance from to ReadOnly
- 462 Change ThreadSafety of MaxDistance from to ReadOnly
- 462 Change ThreadSafety of Looped from to ReadOnly
- 462 Change ThreadSafety of from to ReadOnly
- 462 Change ThreadSafety of from to ReadOnly
- 462 Change ThreadSafety of IsLoaded from to ReadOnly
- 462 Change ThreadSafety of EmitterSize from to ReadOnly
- 456 Add RollOffMinDistance
- 456 Add RollOffMaxDistance
- 456 Change Tags of MaxDistance from [] to [Deprecated]
- 456 Change Tags of EmitterSize from [] to [Deprecated]
- 417 Change Tags of TimePosition from [] to [NotReplicated]
- 417 Change Tags of Playing from [] to [NotReplicated]
- 389 Change Tags of PlaybackSpeed from [] to [NotReplicated]
- 329 Change ValueType of SoundGroup from Object to SoundGroup
- 266 Change Tags of RollOffMode from [Hidden] to []
- 264 Add SoundGroup
- 264 Add PlaybackLoudness
- 262 Add PlaybackSpeed
- 262 Change Tags of Pitch from [] to [Deprecated]
- 262 Change Tags of MinDistance from [] to [Deprecated]
- 262 Add EmitterSize
- 249 Add Resumed
- 249 Add Loaded
- 249 Add RollOffMode
- 249 Add Playing
- 249 Add IsLoaded
- 220 Add MinDistance
- 220 Add MaxDistance
- 204 Add Ended
- 182 Add Resume
- 179 Add Stopped
- 179 Add Played
- 179 Add Paused
- 179 Add DidLoop
- 178 Change ValueType of TimePosition from int to double
- 178 Change ValueType of TimeLength from int to double
- 176 Add TimePosition
- 176 Add TimeLength
- 50 Add pause
- 50 Add isPlaying
- 49 Add stop
- 47 Add play
- 47 Add Stop
- 47 Add Play
- 47 Add Pause
- 47 Add Volume
- 47 Add SoundId
- 47 Add PlayOnRemove
- 47 Add Pitch
- 47 Add Looped
- 47 Add
- 47 Add
- 47 Add Sound
Members 51
ChannelCount
Type | Default | |
---|---|---|
int | 0 |
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Asset |
Loaded/Saved | false |
History 3
- 553 Change Category of ChannelCount from Data to Asset
- 553 Change Default of ChannelCount from to 0
- 491 Add ChannelCount
DidLoop
Parameters (2) | |
---|---|
soundId | string |
numOfTimesLooped | int |
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
.
Thread safety | Unsafe |
---|
EmitterSize
Type | Default | |
---|---|---|
float | 10 |
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.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true/false |
History 11
- 648 Change CanSave of EmitterSize from true to false
- 601 Change Tags of EmitterSize from [] to [Deprecated]
- 601 Change PreferredDescriptor of EmitterSize from to RollOffMinDistance
- 599 Change Tags of EmitterSize from [Deprecated] to []
- 599 Change PreferredDescriptor of EmitterSize from RollOffMinDistance to
- 553 Change PreferredDescriptor of EmitterSize from to RollOffMinDistance
- 553 Change Default of EmitterSize from to 10
- 486 Change ThreadSafety of EmitterSize from ReadOnly to ReadSafe
- 462 Change ThreadSafety of EmitterSize from to ReadOnly
- 456 Change Tags of EmitterSize from [] to [Deprecated]
- 262 Add EmitterSize
Ended
Parameters (1) | |
---|---|
soundId | string |
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.
Thread safety | Unsafe |
---|
IsLoaded
Type | Default | |
---|---|---|
bool | false |
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.
Thread safety | ReadSafe |
---|---|
Category | Asset |
Loaded/Saved | false |
Loaded
Parameters (1) | |
---|---|
soundId | string |
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.
Thread safety | Unsafe |
---|
LoopRegion
Type | Default | |
---|---|---|
NumberRange | 0 60000 |
A range denoting a desired loop start and loop end within the PlaybackRegion, in seconds.
If LoopRegion.Min
>
PlaybackRegion.Min, the loop starts from LoopRegion.Min.If LoopRegion.Min
<
PlaybackRegion.Min, the loop starts from PlaybackRegion.Min.If LoopRegion.Max
>
PlaybackRegion.Max, the loop starts at PlaybackRegion.Max.If LoopRegion.Max
<
PlaybackRegion.Max, the loop starts at exactly that time.If LoopRegion.Min
==
LoopRegion.Max, the Sound uses the PlaybackRegion property instead.
Thread safety | ReadSafe |
---|---|
Category | Regions |
Loaded/Saved | true |
History 2
- 553 Change Default of LoopRegion from to NumberRange(0 60000 )
- 549 Add LoopRegion
Looped
Type | Default | |
---|---|---|
bool | false |
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.
Thread safety | ReadSafe |
---|---|
Category | Playback |
Loaded/Saved | true |
MaxDistance
Type | Default | |
---|---|---|
float | 10000 |
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.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
History 10
- 601 Change Tags of MaxDistance from [] to [Deprecated]
- 601 Change PreferredDescriptor of MaxDistance from to RollOffMaxDistance
- 599 Change Tags of MaxDistance from [Deprecated] to []
- 599 Change PreferredDescriptor of MaxDistance from RollOffMaxDistance to
- 553 Change PreferredDescriptor of MaxDistance from to RollOffMaxDistance
- 553 Change Default of MaxDistance from to 10000
- 486 Change ThreadSafety of MaxDistance from ReadOnly to ReadSafe
- 462 Change ThreadSafety of MaxDistance from to ReadOnly
- 456 Change Tags of MaxDistance from [] to [Deprecated]
- 220 Add MaxDistance
MinDistance
Type | Default | |
---|---|---|
float | 10 |
The minimum distance at which a 3D Sound (direct child of a BasePart or Attachment) will begin to attenuate. Effectively, the emitter size.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true/false |
History 10
- 601 Change Tags of MinDistance from [] to [Deprecated]
- 601 Change PreferredDescriptor of MinDistance from to RollOffMinDistance
- 599 Change Tags of MinDistance from [Deprecated] to []
- 599 Change PreferredDescriptor of MinDistance from RollOffMinDistance to
- 553 Change PreferredDescriptor of MinDistance from to RollOffMinDistance
- 553 Change Default of MinDistance from to 10
- 486 Change ThreadSafety of MinDistance from ReadOnly to ReadSafe
- 462 Change ThreadSafety of MinDistance from to ReadOnly
- 262 Change Tags of MinDistance from [] to [Deprecated]
- 220 Add MinDistance
Pause
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
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().
Thread safety | Unsafe |
---|
Paused
Parameters (1) | |
---|---|
soundId | string |
Thread safety | Unsafe |
---|
Pitch
Type | Default | |
---|---|---|
float | 1 |
Sets how high pitched and fast a Sound is when it is played. The greater the integer, the higher and faster the sound is.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true/false |
Play
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
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
.
Thread safety | Unsafe |
---|
PlayOnRemove
Type | Default | |
---|---|---|
bool | false |
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 = nil
sound.Parent.Parent = nil
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | true |
History 4
- 553 Change Default of PlayOnRemove from to false
- 486 Change ThreadSafety of PlayOnRemove from ReadOnly to ReadSafe
- 462 Change ThreadSafety of PlayOnRemove from to ReadOnly
- 47 Add PlayOnRemove
PlaybackLoudness
Type | Default | |
---|---|---|
double | 0 |
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.
Thread safety | ReadSafe |
---|---|
Category | Playback |
Loaded/Saved | false |
History 5
- 553 Change Default of PlaybackLoudness from to 0
- 553 Change Category of PlaybackLoudness from Data to Playback
- 486 Change ThreadSafety of PlaybackLoudness from ReadOnly to ReadSafe
- 462 Change ThreadSafety of PlaybackLoudness from to ReadOnly
- 264 Add PlaybackLoudness
PlaybackRegion
Type | Default | |
---|---|---|
NumberRange | 0 60000 |
A range denoting a desired start and stop time within the TimeLength, in seconds.
If PlaybackRegion.Min
>
0
, the sound begins to play from the PlaybackRegion.Min time.If PlaybackRegion.Min
<
0
, the sound begins to play from0
.If PlaybackRegion.Max
>
Sound.TimeLength, the sound stops at Sound.TimeLength.If PlaybackRegion.Max
<
Sound.TimeLength, the sound stops at exactly that time.If PlaybackRegion.Min
==
PlaybackRegion.Max, this property is inactive.
Thread safety | ReadSafe |
---|---|
Category | Regions |
Loaded/Saved | true |
History 2
- 553 Change Default of PlaybackRegion from to NumberRange(0 60000 )
- 549 Add PlaybackRegion
PlaybackRegionsEnabled
Type | Default | |
---|---|---|
bool | false |
If true
, this property gives your Sound access to the
PlaybackRegion and
LoopRegion properties which can more-accurately
control its playback.
Thread safety | ReadSafe |
---|---|
Category | Playback |
Loaded/Saved | true |
History 3
- 582 Change Tags of PlaybackRegionsEnabled from [NotBrowsable] to []
- 553 Change Default of PlaybackRegionsEnabled from to false
- 549 Add PlaybackRegionsEnabled
PlaybackSpeed
Type | Default | |
---|---|---|
float | 1 |
Determines the speed at which a Sound will play, with higher values causing the sound to play faster and at a higher pitch.
Thread safety | ReadSafe |
---|---|
Category | Playback |
Loaded/Saved | true |
History 6
- 553 Change Category of PlaybackSpeed from Data to Playback
- 553 Change Default of PlaybackSpeed from to 1
- 486 Change ThreadSafety of PlaybackSpeed from ReadOnly to ReadSafe
- 462 Change ThreadSafety of PlaybackSpeed from to ReadOnly
- 389 Change Tags of PlaybackSpeed from [] to [NotReplicated]
- 262 Add PlaybackSpeed
Played
Parameters (1) | |
---|---|
soundId | string |
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.
Thread safety | Unsafe |
---|
Playing
Type | Default | |
---|---|---|
bool | false |
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
.
Thread safety | ReadSafe |
---|---|
Category | Playback |
Loaded/Saved | true |
Resume
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
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().
Thread safety | Unsafe |
---|
Resumed
Parameters (1) | |
---|---|
soundId | string |
Thread safety | Unsafe |
---|
RollOffMaxDistance
Type | Default | |
---|---|---|
float | 10000 |
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.
Thread safety | ReadSafe |
---|---|
Category | Emitter |
Loaded/Saved | true |
History 8
- 648 Change CanLoad of RollOffMaxDistance from false to true
- 648 Change Tags of RollOffMaxDistance from [NotReplicated] to []
- 648 Change CanSave of RollOffMaxDistance from false to true
- 553 Change Default of RollOffMaxDistance from to 10000
- 553 Change Category of RollOffMaxDistance from Data to Emitter
- 486 Change ThreadSafety of RollOffMaxDistance from ReadOnly to ReadSafe
- 462 Change ThreadSafety of RollOffMaxDistance from to ReadOnly
- 456 Add RollOffMaxDistance
RollOffMinDistance
Type | Default | |
---|---|---|
float | 10 |
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.
Thread safety | ReadSafe |
---|---|
Category | Emitter |
Loaded/Saved | true |
History 8
- 648 Change Tags of RollOffMinDistance from [NotReplicated] to []
- 648 Change CanSave of RollOffMinDistance from false to true
- 648 Change CanLoad of RollOffMinDistance from false to true
- 553 Change Category of RollOffMinDistance from Data to Emitter
- 553 Change Default of RollOffMinDistance from to 10
- 486 Change ThreadSafety of RollOffMinDistance from ReadOnly to ReadSafe
- 462 Change ThreadSafety of RollOffMinDistance from to ReadOnly
- 456 Add RollOffMinDistance
RollOffMode
Type | Default | |
---|---|---|
RollOffMode | Inverse |
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.
Thread safety | ReadSafe |
---|---|
Category | Emitter |
Loaded/Saved | true |
History 6
- 553 Change Category of RollOffMode from Data to Emitter
- 553 Change Default of RollOffMode from to Inverse
- 486 Change ThreadSafety of RollOffMode from ReadOnly to ReadSafe
- 462 Change ThreadSafety of RollOffMode from to ReadOnly
- 266 Change Tags of RollOffMode from [Hidden] to []
- 249 Add RollOffMode
SoundGroup
Type | Default | |
---|---|---|
SoundGroup |
The SoundGroup that is linked to this Sound.
Thread safety | ReadSafe |
---|---|
Category | Routing |
Loaded/Saved | true |
History 6
- 553 Change Category of SoundGroup from Data to Routing
- 553 Change Default of SoundGroup from to
- 486 Change ThreadSafety of SoundGroup from ReadOnly to ReadSafe
- 462 Change ThreadSafety of SoundGroup from to ReadOnly
- 329 Change ValueType of SoundGroup from Object to SoundGroup
- 264 Add SoundGroup
SoundId
Type | Default | |
---|---|---|
ContentId |
This property is the content ID of the sound file to associate with the Sound. See Audio Assets for more information.
Thread safety | ReadSafe |
---|---|
Category | Asset |
Loaded/Saved | true |
Stop
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
This method stops the Sound and sets Playing
to false
, then sets TimePosition to 0
.
Thread safety | Unsafe |
---|
Stopped
Parameters (1) | |
---|---|
soundId | string |
Fires when the Sound is stopped through using Stop(). Destroying a sound while it is playing will not cause this event to fire.
Thread safety | Unsafe |
---|
TimeLength
Type | Default | |
---|---|---|
double | 0 |
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.
Thread safety | ReadSafe |
---|---|
Category | Asset |
Loaded/Saved | false |
History 6
- 553 Change Category of TimeLength from Data to Asset
- 553 Change Default of TimeLength from to 0
- 486 Change ThreadSafety of TimeLength from ReadOnly to ReadSafe
- 462 Change ThreadSafety of TimeLength from to ReadOnly
- 178 Change ValueType of TimeLength from int to double
- 176 Add TimeLength
TimePosition
Type | Default | |
---|---|---|
double | 0 |
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:
local newPosition = 1.5
if newPosition >= sound.TimeLength then
newPosition = newPosition - sound.TimeLength
end
sound.TimePosition = newPosition
Thread safety | ReadSafe |
---|---|
Category | Playback |
Loaded/Saved | true |
History 7
- 553 Change Category of TimePosition from Data to Playback
- 553 Change Default of TimePosition from to 0
- 486 Change ThreadSafety of TimePosition from ReadOnly to ReadSafe
- 462 Change ThreadSafety of TimePosition from to ReadOnly
- 417 Change Tags of TimePosition from [] to [NotReplicated]
- 178 Change ValueType of TimePosition from int to double
- 176 Add TimePosition
Volume
Type | Default | |
---|---|---|
float | 0.5 |
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.
Thread safety | ReadSafe |
---|---|
Category | Playback |
Loaded/Saved | true |
isPlaying
Type | Default | |
---|---|---|
bool | false |
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
pause
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
play
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
stop
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Thread safety | Unsafe |
---|