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

(Stupid Question Time) How to restart this timer?

Asked by 3 years ago

Ok so I'm excruciatingly stupid and cannot for the life of me figure out or find how to make this simple timer script reset. Fyi, it's meant to be a timer gui, and script.Parent.Parent.Time is an IntValue

local seconds = script.Parent.Parent.Time

script.Parent.Text = seconds.Value

for i = 1,seconds.Value do
    wait(1)
    seconds.Value = seconds.value - 1
    script.Parent.Text = seconds.Value
end

2 answers

Log in to vote
0
Answered by 3 years ago

Change the for loop to this:

for loop = 1, -0.1, -.01 do
                seconds.Value = loop
                    wait(.05)
            end
end

What this does is it starts at 1 and ends at -0.1 and the increment is -0.1.

Don't just copy and paste this script, Change the values to what you need. Check if it works though :D.

0
Thank you! RobbyBobby2643 2 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
local seconds = script.Parent.Parent.Time

script.Parent.Text = seconds.Value

for i = 1,seconds.Value do
    wait(1)
    seconds.Value = seconds.value - 1
    script.Parent.Text = seconds.Value
end


while true do -- this should check if the time reaches 0 then it would go up again
if seconds.Value == 0 then
seconds.Value = 10
end
end

i hope this works for you.

Answer this question