Need Help With TimePosition script

This is a simple TimePosition script but I don’t understand why it doesn’t work.

if workspace.Disco.TimePosition == 11 then
	print("START")
end

When I run it there are no errors but START isn’t printed. Is there another way for something to happen if a song reaches a certain time?

Help would be appreciated! :happy1:

1 Like

Well, when you run the script, the sound position will be at 0. And you are only checking the time position when the script is ran. You would have to check it every time it updates. Also, the position would rarely be ever just a single integer, It would usually have decimal points since the sound is playing every millisecond.

My solution:

while wait() do
	local timePos = workspace.Disco.TimePosition
	if timePos >= 10 and timePos <= 12 then--check if its in range
		print("START")
		break-- end the loop to prevent unwanted stress on server
	end
end

Basically what that does is loop check the position and see if its between 10-12.

I hope this helped! :slight_smile:

1 Like