Skip to main content

Sound

Represents a sound that can be played

warning

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:

TypeDescription
SoundReturns self for chaining

Example:

mySound:play()

stop()

Stops the playback of this sound

stop()

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:stop()

pause()

Pauses the current playback of this sound

pause()

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:pause()

isPlaying()

caution

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:

TypeDescription
Boolean-

Example:

mySound:isPlaying()

isLooping()

Checks if this sound is looping

isLooping()

Returns:

TypeDescription
Boolean-

Example:

mySound:isLooping()

Sound Properties

setPos()

Aliases: pos()

Sets the position of this sound

Position is given in world coordinates

Default 0

setPos(pos)

Parameters:

NameTypeDescriptionDefault
posVector3--

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:setPos(player:getPos())

getPos()

Get this sound position

getPos()

Returns:

TypeDescription
Vector3-

Example:

mySound:getPos()

setAttenuation()

Aliases: attenuation()

Sets the attenuation of this sound

Default 1

setAttenuation(attenuation)

Parameters:

NameTypeDescriptionDefault
attenuationNumber--

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:setAttenuation(5)

getAttenuation()

Gets this sound attenuation

getAttenuation()

Returns:

TypeDescription
Number-

Example:

mySound:getAttenuation()

setLoop()

Aliases: loop()

Toggles if this sound should loop

Default false

setLoop(loop)

Parameters:

NameTypeDescriptionDefault
loopBoolean--

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:setLoop(true)

setPitch()

Aliases: pitch()

Sets the pitch of this sound

Default 1

setPitch(pitch)

Parameters:

NameTypeDescriptionDefault
pitchNumber--

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:setPitch(5)

getPitch()

Gets this sound pitch

getPitch()

Returns:

TypeDescription
Number-

Example:

mySound:getPitch()

setSubtitle()

Aliases: subtitle()

Sets the subtitle text of this sound

setSubtitle(subtitle)

Parameters:

NameTypeDescriptionDefault
subtitleString--

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:setSubtitle("Bat ecolocates")

getSubtitle()

Gets the subtitle text from this sound

getSubtitle()

Returns:

TypeDescription
String-

Example:

mySound:getSubtitle()

setVolume()

Aliases: volume()

Sets the volume of this sound

Default 1

setVolume(volume)

Parameters:

NameTypeDescriptionDefault
volumeNumber--

Returns:

TypeDescription
SoundReturns self for chaining

Example:

mySound:setVolume(5)

getVolume()

Gets this sound volume

getVolume()

Returns:

TypeDescription
Number-

Example:

mySound:getVolume()