Sound
Represents a sound that can be played
This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.
Obtained by indexing the SoundAPI
Exists as an object-oriented alternative to sounds:playSound()
Playing
play()
Plays this sound, or resume a paused sound
play()
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:play()
stop()
Stops the playback of this sound
stop()
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:stop()
pause()
Pauses the current playback of this sound
pause()
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:pause()
isPlaying()
This function is unreliable and may not work as intended. A usable workaround is to stop the sound before you play it (even if it isn't playing) so you can reset the playing state.
Checks if this sound is being played
isPlaying()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
mySound:isPlaying()
isLooping()
Checks if this sound is looping
isLooping()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
mySound:isLooping()
Sound Properties
setPos()
Aliases: pos()
Sets the position of this sound
Position is given in world coordinates
Default 0
- Overload 1
- Overload 2
Example:
mySound:setPos(player:getPos())
getPos()
Get this sound position
getPos()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
mySound:getPos()
setAttenuation()
Aliases: attenuation()
Sets the attenuation of this sound
Default 1
setAttenuation(attenuation)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attenuation | Number | - | - |
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:setAttenuation(5)
getAttenuation()
Gets this sound attenuation
getAttenuation()
Returns:
Type | Description |
---|---|
Number | - |
Example:
mySound:getAttenuation()
setLoop()
Aliases: loop()
Toggles if this sound should loop
Default false
setLoop(loop)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loop | Boolean | - | - |
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:setLoop(true)
setPitch()
Aliases: pitch()
Sets the pitch of this sound
Default 1
setPitch(pitch)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pitch | Number | - | - |
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:setPitch(5)
getPitch()
Gets this sound pitch
getPitch()
Returns:
Type | Description |
---|---|
Number | - |
Example:
mySound:getPitch()
setSubtitle()
Aliases: subtitle()
Sets the subtitle text of this sound
setSubtitle(subtitle)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subtitle | String | - | - |
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:setSubtitle("Bat ecolocates")
getSubtitle()
Gets the subtitle text from this sound
getSubtitle()
Returns:
Type | Description |
---|---|
String | - |
Example:
mySound:getSubtitle()
setVolume()
Aliases: volume()
Sets the volume of this sound
Default 1
setVolume(volume)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
volume | Number | - | - |
Returns:
Type | Description |
---|---|
Sound | Returns self for chaining |
Example:
mySound:setVolume(5)
getVolume()
Gets this sound volume
getVolume()
Returns:
Type | Description |
---|---|
Number | - |
Example:
mySound:getVolume()