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

While true do help?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

Is there another way of doing this?

hint = Instance.new("Hint",game.Workspace)
hint.Text = 30
while true do
hint.Text = 10
wait(1)
hint.Text = 9
wait(1)
hint.Text = 8
wait(1)
hint.Text = 7
wait(1)
hint.Text = 6
wait(1)
hint.Text = 5
wait(1)
hint.Text = 4
wait(1)
hint.Text = 3
wait(1)
hint.Text = 2
wait(1)
hint.Text = 1


end

1 answer

Log in to vote
2
Answered by
NotSoNorm 777 Moderation Voter
8 years ago

Yes, for loops, It's much more efficent:

hint = Instance.new("Hint",game.Workspace)
hint.Text = 30
for i = 10,1, -1 do --Repeats 10 times, going down by 1 each time
    hint.Text = i
    wait(1)
end


Ad

Answer this question