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

Why timer doesn't works as it supposed to? It won't change value

			while timer do
				wait(1)
				speed.Text = speed.Text - 1
			
				if speed.Text <= 0 then
					timer = false
				end
			end

for some reason it changes speed.Text to 4 after 1 second and won't change it anymore when I need to keep it changing until its 0...? I don't want to use values since I have to make that script server sided, I just want it to work with local script

1 answer

✓ Accepted answer

If you're planning to do a timer, I don't suggest using a while loop. Use a for loop instead.

local timer = 5 --Change this to any number.
for i  = timer, 1, -1 do --Count down by 1 second
	print(i)
	wait(1)
end

if you want to use this forever (e.g. for like a round system) then put a while wait() do at the top. Edit: If you want to stop the timer, then add a permanent debounce.

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