Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.