M MY Multiplayer: Wiki
Side
Kind

getSoundLength

Shared

Returns the sound's length.

float|false getSoundLength(sound sound)

Parameters

NameTypeDescription
soundsoundThe sound element. On the client a dui element also works, for the browser's sound.

Returns

The length in seconds, or false if the sound was not found.

Example

local music = playSound("sounds/track.mp3")
outputDebugString(("Duration: %.1f s"):format(getSoundLength(music)))

See also