Audio¶
System · Audio · server and client scripts
Audio plays one-shot 2D and 3D sounds, controls mixer bus volumes, and sets how loud touching parts sound. For a sound that loops or plays from an entity, add a Sound component to the entity instead.
GetBusVolume¶
GetBusVolume returns this client's local volume multiplier (0 to 10) for a mixer bus ("Master", "Music", "SFX", or "UI").
Errors (1)
| Error | When |
|---|---|
GetBusVolume can only be called from a client script |
Called from a server script. |
GetPlaceBusVolume¶
GetPlaceBusVolume returns the place's shared volume multiplier (0 to 10) for a mixer bus ("Master", "Music", "SFX", or "UI").
Play¶
Play plays a one-shot 2D sound. Pass the asset id as a string and an optional AudioPlayOptions table with Volume, PlaybackSpeed, Bus, and, on the server, To.
Returns false when the server already queued 64 sounds this tick, otherwise true.
Example
PlayAt¶
PlayAt plays a one-shot 3D sound at a world position. Pass the asset id as a string: a number cannot represent every digit of a 64-bit id. Pass an optional AudioPlayAtOptions table as the third argument. The server does not send a cue to players whose character is farther than RollOffMaxDistance (default 200 units) away.
Returns false when the server already queued 64 sounds this tick, otherwise true.
Example
SetBusVolume¶
SetBusVolume sets this client's local volume multiplier (0 to 10) for a mixer bus ("Master", "Music", "SFX", or "UI").
Example
Errors (1)
| Error | When |
|---|---|
SetBusVolume can only be called from a client script |
Called from a server script. |
SetPlaceBusVolume¶
SetPlaceBusVolume sets the place's shared volume multiplier (0 to 10) for a mixer bus ("Master", "Music", "SFX", or "UI"). Only server scripts may call it.
Example
Errors (1)
| Error | When |
|---|---|
SetPlaceBusVolume can only be called from the server |
Called from a client script. |
SurfaceSoundsVolume¶
SurfaceSoundsVolume is the volume multiplier of the impact and sliding sounds of touching parts, from 0 (silent) to 10.
Default 1
Errors (1)
| Error | When |
|---|---|
SurfaceSoundsVolume can only be written from the server |
Written from a client script. |