Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a number counter?

Asked by 7 years ago
Edited 7 years ago

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!

0
For loop and wait NexanianStudios 91 — 7y

1 answer

Log in to vote
0
Answered by
Mineloxer 187
7 years ago

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
Ad

Answer this question