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

How can I get my script to wait precisely one second each time?

Asked by
iKobi 0
7 years ago

I need my script, in the end, to be exactly (or as close to) 30 seconds as possible... Here is the part I am talking about:

1local thing = game.Workspace.SecondsValue.Value -- This is 30 in a NumValue so I can change it later
2 
3for i = 1, thing do
4wait(1)
5thing = thing - 1
6script.Parent.Parent.TextLabel.Text = tostring(thing)
7end

1 answer

Log in to vote
0
Answered by 7 years ago

Hi, the problem is just that the wait must be in the end of the statement just like this:

1local thing = game.Workspace.SecondsValue.Value -- This is 30 in a NumValue so I can change it later
2 
3for i = 1, thing do
4thing = thing - 1
5script.Parent.Parent.TextLabel.Text = tostring(thing)
6wait(1)
7end
Ad

Answer this question