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

Is there a way to start my timer again/ reset it? it does start

Asked by 5 years ago
local function ResetTimer()

running,paused = false,false

Timer.Label.Text = "0.000"

current1 = 0

warn("reset")

end



function DisplayTimer()

local min = tostring(math.floor(current1/60))

local sec = tostring(math.floor(current1%60))

local mili = tostring(math.floor((current1%60)*100000))

mili = (#mili == 1 and ("00" .. mili) or #mili == 2 and ("0" .. mili) or mili)

Timer.Label.Text = (min..":"..sec .. "." .. mili)

end



function StartTimer(resetT)

ResetTimer()

running,paused = true,false

if (resetT) then

current1 = 0 begin = tick()

end

while (running) do

if (not paused) then

current1 = (tick()-begin)

DisplayTimer()

--warn(current1)

end

wait()

end

end

Answer this question