Issue with sound

I’m creating a sound and every time I try to get it’s length, it’s zero despite the song being a minute and a half long.

function sound(id)
	local s= workspace:FindFirstChild("Music") or"Sound", workspace)
	s.Name = "Music"
	s.Volume = 2
	s.SoundId = string.format("rbxassetid://%d", id)


	return sound

local s = sound(142376088)

print(s.TimeLength) --> 0

It could possibly be in part due to not being loaded in yet. Perhaps wait until it is loaded in before you get its length.

repeat wait() until s.IsLoaded

1 Like