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
6 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:

local thing = game.Workspace.SecondsValue.Value -- This is 30 in a NumValue so I can change it later

for i = 1, thing do 
wait(1)
thing = thing - 1 
script.Parent.Parent.TextLabel.Text = tostring(thing) 
end

1 answer

Log in to vote
0
Answered by 6 years ago

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

local thing = game.Workspace.SecondsValue.Value -- This is 30 in a NumValue so I can change it later

for i = 1, thing do 
thing = thing - 1 
script.Parent.Parent.TextLabel.Text = tostring(thing)
wait(1)
end

Ad

Answer this question