Skip to content

GetSoundLength

How long one of your sound files plays.

Read from the file itself - no game needed. Use it to time what follows a line.

GetSoundLength(file)
Parameter Type
file string the file’s path in the sounds folder

number - seconds; nil and the reason when the file cannot be played

local seconds = GetSoundLength("elder_story.ogg")
if seconds then SetTimer(function() SendClientMessage(pid, COLOR_GOLD, "The elder falls silent.") end, math.floor(seconds * 1000)) end

PlayEntitySound · OnEntitySoundEnd · the Sound files group of the index