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

How do I make a countdown timer[Unanswered]?

Asked by
faruque 30
10 years ago

This is what I have got so far but it doesn't countdown.

for i= 1,20 do
    wait(1)
    print(i)
script.Parent.Text= i
end
0
print(20-i) M39a9am3R 3210 — 10y

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

You're very close. It turns out, there is a way to make for loop count down instead of up. You use the third, optional argument, which is how much is added to i each time the for loop runs. By default, this is 1. But if we set it to -1, it will cause the loop to count down.

for i = 20,1,-1 do
    --code
end
Ad

Answer this question