Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Time Length In Sounds Not Loading?

So I'm trying to make a random music player, and trying to make it more efficient by it getting the exact length of the song and shortening it by 5-10 seconds for a fade out. I've made this successfully working in studio however it never seems to work in server.

local sound = Instance.new("Sound", workspace)
sound.Name = hash
sound.SoundId = "http://www.roblox.com/asset/?id="..current
sound.Volume = 0
sound:Play()
while wait() do --I was encontering this issue so I added a loop to check if its loaded
	if sound.TimeLength > 0 then
		length = sound.TimeLength --"length" is just a variable I made so I can cut 5 seconds off later
		break
	end
end
for fade = 1, 100 do
	sound.Volume = sound.Volume +0.01
	wait()
end

Are we just not allowed to access TimeLength? Or is there a problem with this script?

2 comments

0

that only works on localsounds

0

Does this mean you can create sounds from a local script for this to work?

1 answer

TimeLength and TimePosition only work in LocalScripts I believe. So you'd want to move all of this to a LocalScript and then mess with the sound there.

This discussion is preserved as it was. New answers, comments, and votes are closed.