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

How do you make a number counter?

Lets say you have the number 1000 displayed. How do I have it count down to 0?

By counting down I mean by not having 1000 switch to 0, I want numbers after 1000 to reach to 0. Example: 1000 999 998 and so on intill it hits 0 I also want it to happen in a quick amount of time but also slow enough to be noticed.

Thank you very much for any help! I really do appreciate all help!

1 comment

0

For loop and wait

1 answer

✓ Accepted answer

You can use the trusty for-loop and the wait() function like so:

local counter = 1000

for i = counter, 0, -1 do
	wait(0.1) --//Wait function uses seconds
	counter = i
	print(counter) --//Optional
end

You can also use the while-loop:

local counter = 1000

while counter > 0 do
	wait(0.1)
	print(counter) --//Optional
	counter = counter - 1
end

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