rojo/.cursor/rules/roblox/reference/engine/classes/Sound.yaml
2026-02-02 12:08:47 -06:00

1078 lines
33 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Sound
type: class
memory_category: Internal
summary: |
An object that emits sound. This object can be placed within a
`Class.BasePart` or `Class.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.
description: |
`Class.Sound` is an object that emits sound. When placed in a `Class.BasePart`
or an `Class.Attachment`, this object will emit its sound from that part's
`Class.BasePart.Position` or the attachment's
`Class.Attachment.WorldPosition`. In this placement, a `Class.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 `Class.Camera` position) and the position of the sound's
parent. For more information, see `Class.Sound.RollOffMode|RollOffMode`.
A sound is considered "global" if it is **not** parented to a `Class.BasePart`
or an `Class.Attachment`. In this case, the sound will play at the same volume
throughout the entire place.
code_samples:
- Sound-3D-Parent
inherits:
- Instance
descendants: []
tags: []
deprecation_message: ''
properties:
- name: Sound.AudioContent
summary: ''
description: ''
code_samples: []
type: Content
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Asset
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.ChannelCount
summary: ''
description: ''
code_samples: []
type: int
tags:
- ReadOnly
- NotReplicated
- NotBrowsable
deprecation_message: ''
security:
read: RobloxScriptSecurity
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Asset
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.EmitterSize
summary: |
The minimum distance, in studs, at which a 3D `Class.Sound` (direct child
of a `Class.BasePart` or `Class.Attachment`) will begin to attenuate
(decrease in volume).
description: |
The minimum distance, in studs, at which a 3D `Class.Sound` (direct child
of a `Class.BasePart` or `Class.Attachment`) will begin to attenuate
(decrease in volume).
Sounds parented to a `Class.BasePart` or `Class.Attachment` that are
descendants of the `Class.Workspace` are considered 3D sounds and their
volume while playing is dependent on the distance between the client's
sound listener (`Class.Camera` position by default) and the Sound's
parent. Two properties influence this behavior EmitterSize and
`Class.Sound.RollOffMode`.
The way the `Class.Sound` attenuates (fades out) after the distance
between the listener and the sound exceeds the EmitterSize is determined
by RollOffMode.
code_samples:
- Sound-3D-Parent
type: float
tags:
- Deprecated
deprecation_message: |
This property has deprecated in favor of `Class.Sound.RollOffMinDistance`
and `Class.Sound.RollOffMaxDistance` which should be used instead in new
work.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: false
capabilities:
- LegacySound
- name: Sound.IsLoaded
summary: |
This property is `true` when the `Class.Sound` has loaded from Roblox
servers and is ready to play.
description: |
This property is `true` when the `Class.Sound` has loaded from Roblox
servers and is ready to play. You can use this property and the
`Class.Sound.Loaded|Loaded` event to verify a sound has loaded before
playing it.
code_samples:
- Sound-Loaded
type: boolean
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Asset
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.IsMutedForCapture
summary: ''
description: ''
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: RobloxScriptSecurity
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.IsPaused
summary: |
Read-only property which returns `true` when the `Class.Sound` is not
playing.
description: |
This read-only property returns `true` when the `Class.Sound` is not
playing. Note that it can return `true` if a sound has been paused using
`Class.Sound:Pause()|Pause()`, if it has been stopped using
`Class.Sound:Stop()|Stop()`, or the sound has never been played.
As `Class.Sound.IsPaused|IsPaused` is read-only, it cannot be used to stop
the sound; `Class.Sound:Stop()|Stop()` or `Class.Sound:Pause()|Pause()`
should be used instead.
code_samples:
- Sound-IsPlaying-IsPaused
type: boolean
tags:
- Hidden
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.IsPlaying
summary: |
Read-only property which returns `true` when the `Class.Sound` is playing.
description: |
This read-only property returns true when the `Class.Sound` is playing.
As `Class.Sound.IsPlaying|IsPlaying` is read-only, it cannot be used to
play the sound; `Class.Sound:Play()|Play()` should be used instead.
code_samples:
- Sound-IsPlaying-IsPaused
type: boolean
tags:
- Hidden
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.isPlaying
summary: ''
description: ''
code_samples: []
type: boolean
tags:
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This deprecated property is a variant of `Class.Sound.IsPlaying` which
should be used instead.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.Looped
summary: |
Sets whether or not the `Class.Sound` repeats once it has finished
playing.
description: |
This sets whether or not the `Class.Sound` repeats once it has finished
playing. Looped sounds are suitable for a range of applications including
music and background ambient sounds.
The `Class.Sound.DidLoop|DidLoop` event can be used to track the number of
times as sound has looped.
code_samples:
- Sound-Looping-2
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.LoopRegion
summary: |
A range denoting a desired loop start and loop end within the
`Class.Sound.PlaybackRegion|PlaybackRegion`, in seconds.
description: |
A range denoting a desired loop start and loop end within the
`Class.Sound.PlaybackRegion|PlaybackRegion`, in seconds.
- If `Class.Sound.LoopRegion|LoopRegion.Min` `>`
`Class.Sound.PlaybackRegion|PlaybackRegion.Min`, the loop starts from
`Class.Sound.LoopRegion|LoopRegion.Min`.
- If `Class.Sound.LoopRegion|LoopRegion.Min` `<`
`Class.Sound.PlaybackRegion|PlaybackRegion.Min`, the loop starts from
`Class.Sound.PlaybackRegion|PlaybackRegion.Min`.
- If `Class.Sound.LoopRegion|LoopRegion.Max` `>`
`Class.Sound.PlaybackRegion|PlaybackRegion.Max`, the loop starts at
`Class.Sound.PlaybackRegion|PlaybackRegion.Max`.
- If `Class.Sound.LoopRegion|LoopRegion.Max` `<`
`Class.Sound.PlaybackRegion|PlaybackRegion.Max`, the loop starts at
**exactly** that time.
- If `Class.Sound.LoopRegion|LoopRegion.Min` `==`
`Class.Sound.LoopRegion|LoopRegion.Max`, the `Class.Sound` uses the
`Class.Sound.PlaybackRegion|PlaybackRegion` property instead.
code_samples: []
type: NumberRange
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Regions
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.MaxDistance
summary: |
The maximum distance, in studs, a client's listener can be from the
`Class.Sound|Sound\s` origin and still hear it. Only applies to Sounds
parented to a `Class.Part` or `Class.Attachment` (3D sounds).
description: |
The maximum distance, in studs, a client's listener can be from the
`Class.Sound` origin and still hear it. Only applies to Sounds parented to
a `Class.Part` or `Class.Attachment` (3D sounds).
How MaxDistance impacts the attenuation of a sound (manner in which it
fades out) is dependent on the `Class.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 `Class.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.
code_samples:
- Sound-MaxDistance
type: float
tags:
- Deprecated
deprecation_message: |
This property has deprecated in favor of `Class.Sound.RollOffMinDistance`
and `Class.Sound.RollOffMaxDistance` which should be used instead in new
work.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.MinDistance
summary: |
The minimum distance at which a 3D `Class.Sound` (direct child of a
`Class.BasePart` or `Class.Attachment`) will begin to attenuate.
Effectively, the emitter size.
description: |
The minimum distance at which a 3D `Class.Sound` (direct child of a
`Class.BasePart` or `Class.Attachment`) will begin to attenuate.
Effectively, the emitter size.
code_samples: []
type: float
tags:
- Deprecated
deprecation_message: |
MinDistance has been superseded by `Class.Sound.EmitterSize`, whose name
better describes this properties behavior.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: false
capabilities:
- LegacySound
- name: Sound.Pitch
summary: |
Sets how high pitched and fast a `Class.Sound` is when it is played. The
greater the integer, the higher and faster the `Class.Sound` is.
description: |
Sets how high pitched and fast a `Class.Sound` is when it is played. The
greater the integer, the higher and faster the sound is.
code_samples: []
type: float
tags:
- Deprecated
deprecation_message: |
This property has been deprecated in favor of `Class.Sound.PlaybackSpeed`
whose name suits the behavior better.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: false
capabilities:
- LegacySound
- name: Sound.PlaybackLoudness
summary: |
A number between `0` and `1000` indicating how loud the `Class.Sound` is
currently playing back.
description: |
A number between `0` and `1000` indicating how loud the `Class.Sound` is
currently playing back. This property reflects the amplitude of the
sound's playback in the instance of time it is read.
code_samples:
- Sound-PlaybackLoudness
type: double
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.PlaybackRegion
summary: |
A range denoting a desired start and stop time within the
`Class.Sound.TimeLength|TimeLength`, in seconds.
description: |
A range denoting a desired start and stop time within the
`Class.Sound.TimeLength|TimeLength`, in seconds.
- If `Class.Sound.PlaybackRegion|PlaybackRegion.Min` `>` `0`, the sound
begins to play from the `Class.Sound.PlaybackRegion|PlaybackRegion.Min`
time.
- If `Class.Sound.PlaybackRegion|PlaybackRegion.Min` `<` `0`, the sound
begins to play from `0`.
- If `Class.Sound.PlaybackRegion|PlaybackRegion.Max` `>`
`Class.Sound.TimeLength`, the sound stops at `Class.Sound.TimeLength`.
- If `Class.Sound.PlaybackRegion|PlaybackRegion.Max` `<`
`Class.Sound.TimeLength`, the sound stops at **exactly** that time.
- If `Class.Sound.PlaybackRegion|PlaybackRegion.Min` `==`
`Class.Sound.PlaybackRegion|PlaybackRegion.Max`, this property is
inactive.
code_samples: []
type: NumberRange
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Regions
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.PlaybackRegionsEnabled
summary: |
If `true`, this property gives your `Class.Sound` access to the
`Class.Sound.PlaybackRegion|PlaybackRegion` and
`Class.Sound.LoopRegion|LoopRegion` properties which can more-accurately
control its playback.
description: |
If `true`, this property gives your `Class.Sound` access to the
`Class.Sound.PlaybackRegion|PlaybackRegion` and
`Class.Sound.LoopRegion|LoopRegion` properties which can more-accurately
control its playback.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.PlaybackSpeed
summary: |
Determines the speed at which a `Class.Sound` will play, with higher
values causing the sound to play faster and at a higher pitch.
description: |
Determines the speed at which a `Class.Sound` will play, with higher
values causing the sound to play faster and at a higher pitch.
code_samples:
- Sound-PlaybackSpeed
type: float
tags:
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.Playing
summary: |
Indicates whether the `Class.Sound` is currently playing.
description: |
Indicates whether the `Class.Sound` is currently playing. This can be
toggled, and this property will always replicate.
In Studio's [Properties](../../../studio/properties.md) window, while in
**Edit** mode, toggling `Class.Sound.Playing|Playing` to `true` does not
begin playing the sound, but the sound will begin playing during runtime.
This property should not be confused with
`Class.Sound.IsPlaying|IsPlaying` which is a read-only property.
Note that when `Class.Sound.Playing|Playing` is set to `false`, the
`Class.Sound.TimePosition|TimePosition` property of the sound will not
reset, meaning that when `Class.Sound.Playing|Playing` is set to `true`
again, the audio will continue from the time position it was at when it
was stopped. However, if the `Class.Sound:Play()|Play()` function is used
to resume the sound, the time position will reset to `0`.
code_samples:
- Sound-Playing
type: boolean
tags:
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.PlayOnRemove
summary: |
When `true`, the `Class.Sound` will play when it is removed from the
experience.
description: |
When `true`, the `Class.Sound` will play when it is removed from the
experience by parenting the `Class.Sound` or one if its ancestors to
`nil`. This means all of the following will cause the sound to play when
`Class.Sound.PlayOnRemove|PlayOnRemove` is `true`:
- `sound:Destroy()`
- `sound.Parent = nil`
- `sound.Parent.Parent = nil`
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Behavior
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.RollOffMaxDistance
summary: |
The maximum distance, in studs, a client's listener can be from the
sound's origin and still hear it. Only applies to `Class.Sound|Sounds`
parented to a `Class.BasePart` or `Class.Attachment`.
description: |
The maximum distance, in studs, a client's listener can be from the
sound's origin and still hear it. Only applies to `Class.Sound|Sounds`
parented to a `Class.BasePart` or `Class.Attachment`.
How `Class.Sound.RollOffMaxDistance|RollOffMaxDistance` impacts the
attenuation of a sound (manner in which it fades out) is dependent on the
`Class.Sound.RollOffMode|RollOffMode` property.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Emitter
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.RollOffMinDistance
summary: |
The minimum distance, in studs, at which a `Class.Sound` which is parented
to a `Class.BasePart` or `Class.Attachment` will begin to attenuate
(decrease in volume).
description: |
The minimum distance, in studs, at which a `Class.Sound` which is parented
to a `Class.BasePart` or `Class.Attachment` will begin to attenuate
(decrease in volume).
How `Class.Sound.RollOffMinDistance|RollOffMinDistance` impacts the
attenuation of a sound (manner in which it fades out) is dependent on the
`Class.Sound.RollOffMode|RollOffMode` property.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Emitter
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.RollOffMode
summary: |
Controls how the volume of a `Class.Sound` which is parented to a
`Class.BasePart` or `Class.Attachment` attenuates (fades out) as the
distance between the listener and parent changes.
description: |
This property controls how the volume of a `Class.Sound` which is parented
to a `Class.BasePart` or `Class.Attachment` attenuates (fades out) as the
distance between the listener and parent changes.
For details on the different modes, see `Enum.RollOffMode`.
code_samples: []
type: RollOffMode
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Emitter
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.SoundGroup
summary: |
The `Class.SoundGroup` that is linked to this `Class.Sound`.
description: |
The `Class.SoundGroup` that is linked to this `Class.Sound`.
code_samples: []
type: SoundGroup
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Routing
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.SoundId
summary: |
Content ID of the sound file to associate with the `Class.Sound`.
description: |
This property is the content ID of the sound file to associate with the
`Class.Sound`. See [Audio Assets](../../../audio/assets.md) for more
information.
code_samples: []
type: ContentId
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Asset
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.TimeLength
summary: |
The length of the `Class.Sound` in seconds.
description: |
The length of the `Class.Sound` in seconds. If the `Class.Sound` is not
loaded, this value will be `0`.
This property is often used in conjunction with
`Class.Sound.PlaybackSpeed|PlaybackSpeed` to adjust the speed of a sound
so that it lasts for a specific duration.
code_samples:
- Sound-PlaybackSpeed-TimeLength
type: double
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Asset
serialization:
can_load: false
can_save: false
capabilities:
- LegacySound
- name: Sound.TimePosition
summary: |
Progress of the `Class.Sound` in seconds. Can be changed to move the
playback position of the `Class.Sound` both before and during playback.
description: |
This property reflects the progress of the `Class.Sound` in seconds. It
can be changed to move the playback position of the sound both before and
during playback.
As a `Class.Sound` is played, `Class.Sound.TimePosition|TimePosition`
increases at a rate of `Class.Sound.PlaybackSpeed|PlaybackSpeed` per
second. Once `Class.Sound.TimePosition|TimePosition` reaches
`Class.Sound.TimeLength|TimeLength`, the sound will stop unless it is
`Class.Sound.Looped|Looped`.
Note that setting `Class.Sound.TimePosition|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
```
code_samples:
- Sound-TimePosition
type: double
tags:
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
- name: Sound.Volume
summary: |
The volume of the `Class.Sound`.
description: |
The volume of the `Class.Sound`. Can be set between `0` and `10` and
defaults to `0.5`.
Note that if the `Class.Sound` is a member of a `Class.SoundGroup`, its
playback volume (but not its `Class.Sound.Volume|Volume` property) will be
influenced by the group's `Class.SoundGroup.Volume` property.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Playback
serialization:
can_load: true
can_save: true
capabilities:
- LegacySound
methods:
- name: Sound:Pause
summary: |
Pauses playback of the `Class.Sound` if it is playing.
description: |
This method pauses playback of the `Class.Sound` if it is playing, setting
`Class.Sound.Playing|Playing` to `false`. Unlike
`Class.Sound:Stop()|Stop()`, it does not reset
`Class.Sound.TimePosition|TimePosition`, meaning the sound can be resumed
using `Class.Sound:Resume()|Resume()`.
code_samples:
- Sound-Functions
parameters: []
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- LegacySound
- name: Sound:pause
summary: ''
description: ''
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: |
This deprecated function is a variant of `Class.Sound:Pause()` which
should be used instead.
security: None
thread_safety: Unsafe
capabilities:
- LegacySound
- name: Sound:Play
summary: |
Plays the `Class.Sound`.
description: |
This method plays the `Class.Sound` and sets
`Class.Sound.TimePosition|TimePosition` to the last value set by a script
(or `0` if it has not been set), then sets `Class.Sound.Playing|Playing`
to `true`.
code_samples:
- Sound-Functions
parameters: []
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- LegacySound
- name: Sound:play
summary: ''
description: ''
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: |
This deprecated function is a variant of `Class.Sound:Play()` which should
be used instead.
security: None
thread_safety: Unsafe
capabilities:
- LegacySound
- name: Sound:Resume
summary: |
Resumes the `Class.Sound`.
description: |
This method resumes the `Class.Sound` and sets
`Class.Sound.Playing|Playing` to `true`. Does not alter
`Class.Sound.TimePosition|TimePosition` and thus can be used to resume
playback of a sound paused through `Class.Sound:Pause()|Pause()`.
code_samples:
- Sound-Functions
parameters: []
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- LegacySound
- name: Sound:Stop
summary: |
Stops the `Class.Sound`.
description: |
This method stops the `Class.Sound` and sets `Class.Sound.Playing|Playing`
to `false`, then sets `Class.Sound.TimePosition|TimePosition` to `0`.
code_samples:
- Sound-Functions
parameters: []
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- LegacySound
- name: Sound:stop
summary: ''
description: ''
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: |
This deprecated function is a variant of `Class.Sound:Stop()` which should
be used instead.
security: None
thread_safety: Unsafe
capabilities:
- LegacySound
events:
- name: Sound.DidLoop
summary: |
Fires whenever the `Class.Sound` loops.
description: |
Fires whenever the `Class.Sound` loops. Returns `soundId` and
`numOfTimesLooped`, giving the content ID of the sound and the number of
times looped respectively.
When the `Class.Sound` is stopped through `Class.Sound:Stop()|Stop()`, the
looped counter resets meaning the next `Class.Sound.DidLoop|DidLoop` event
will return `1` for `numOfTimesLooped`.
code_samples:
- Sound-Looping-2
parameters:
- name: soundId
type: string
default:
summary: |
The `Class.Sound.SoundId|SoundId` of the `Class.Sound` that looped.
- name: numOfTimesLooped
type: int
default:
summary: |
The number of times the `Class.Sound` has looped.
tags: []
deprecation_message: ''
security: None
capabilities:
- LegacySound
- name: Sound.Ended
summary: |
Fires when the `Class.Sound` has completed playback and stopped.
description: |
Fires when the `Class.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
`Class.Sound.Looped|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
`Class.Sound.Stopped|Stopped` event.
code_samples: []
parameters:
- name: soundId
type: string
default:
summary: |
The `Class.Sound.SoundId|SoundId` of the `Class.Sound` that has ended.
tags: []
deprecation_message: ''
security: None
capabilities:
- LegacySound
- name: Sound.Loaded
summary: |
Fires when the `Class.Sound` is loaded.
description: |
Fires when the `Class.Sound` is loaded.
As this event only fires at the time the sound is loaded, it's recommended
to check the sound's `Class.Sound.IsLoaded|IsLoaded` property prior to
connecting to this event.
code_samples:
- Sound-Loaded
parameters:
- name: soundId
type: string
default:
summary: |
The `Class.Sound.SoundId|SoundId` of the `Class.Sound` that loaded.
tags: []
deprecation_message: ''
security: None
capabilities:
- LegacySound
- name: Sound.Paused
summary: |
Fires whenever the `Class.Sound` is paused using
`Class.Sound:Pause()|Pause()`.
description: |
Fires whenever the `Class.Sound` is paused using
`Class.Sound:Pause()|Pause()`.
code_samples:
- Sound-Functions
parameters:
- name: soundId
type: string
default:
summary: |
The `Class.Sound.SoundId|SoundId` of the `Class.Sound` that was
paused.
tags: []
deprecation_message: ''
security: None
capabilities:
- LegacySound
- name: Sound.Played
summary: |
Fires whenever the `Class.Sound` is played using
`Class.Sound:Play()|Play()`.
description: |
Fires whenever the `Class.Sound` is played using
`Class.Sound:Play()|Play()`. This event will **not** fire if the
`Class.Sound` is played due to `Class.Sound.PlayOnRemove|PlayOnRemove`
being set to `true` and the sound being destroyed.
code_samples:
- Sound-Functions
parameters:
- name: soundId
type: string
default:
summary: |
The `Class.Sound.SoundId|SoundId` of the `Class.Sound` that was
played.
tags: []
deprecation_message: ''
security: None
capabilities:
- LegacySound
- name: Sound.Resumed
summary: |
Fires when the `Class.Sound` is resumed using
`Class.Sound:Resume()|Resume()`.
description: |
Fires when the `Class.Sound` is resumed using
`Class.Sound:Resume()|Resume()`.
code_samples:
- Sound-Functions
parameters:
- name: soundId
type: string
default:
summary: |
The `Class.Sound.SoundId|SoundId` of the `Class.Sound` being resumed.
tags: []
deprecation_message: ''
security: None
capabilities:
- LegacySound
- name: Sound.Stopped
summary: |
Fires when the `Class.Sound` is stopped through using
`Class.Sound:Stop()|Stop()`.
description: |
Fires when the `Class.Sound` is stopped through using
`Class.Sound:Stop()|Stop()`. Destroying a sound while it is playing will
not cause this event to fire.
code_samples:
- Sound-Functions
parameters:
- name: soundId
type: string
default:
summary: |
The `Class.Sound.SoundId|SoundId` of the `Class.Sound` that stopped.
tags: []
deprecation_message: ''
security: None
capabilities:
- LegacySound
callbacks: []