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

Sound

Show deprecated

Sound

Show deprecated

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

2D and 3D Sound

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

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

Sound Replication

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

Properties

float

EmitterSize

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

bool

IsLoaded

[ReadOnly] [NotReplicated]

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

bool

IsPaused

[ReadOnly] [NotReplicated]

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

bool

IsPlaying

[ReadOnly] [NotReplicated]

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

bool

Looped

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

float

MaxDistance

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

bool

PlayOnRemove

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

double

PlaybackLoudness

[ReadOnly] [NotReplicated]

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

float

PlaybackSpeed

[NotReplicated]

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

bool

Playing

Indicates whether the Sound is currently playing.

RollOffMode

RollOffMode

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

SoundGroup

SoundGroup

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

Content

SoundId

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

double

TimeLength

[ReadOnly] [NotReplicated]

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

double

TimePosition

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

float

Volume

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

Functions

void

Pause ( )

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

void

Play ( )

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

void

Resume ( )

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

void

Stop ( )

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

Events

RBXScriptSignal

DidLoop ( string soundId , int numOfTimesLooped )

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

RBXScriptSignal

Ended ( string soundId )

Fires when the Sound has completed playback and stopped.

RBXScriptSignal

Loaded ( string soundId )

Fires when the /Sound is loaded.

RBXScriptSignal

Paused ( string soundId )

Fires whenever the Sound is paused using Sound/Pause.

RBXScriptSignal

Played ( string soundId )

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

RBXScriptSignal

Resumed ( string soundId )

Fires when the Sound is resumed using Sound/Resume.

RBXScriptSignal

Stopped ( string soundId )

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