Hi everyone!
I was making a timer which would start counting from 0, and go in milliseconds (similar to a speedrun timer). Here is what i tried to do:
if isRunning == false then
isRunning = true
local timer = script.Parent -- a text label
local milaseconds = 0 -- totally correctly spelled
local seconds = 0
local minutes = 0
while isRunning == true do
wait(0.0001)
milaseconds += 1
if milaseconds == 100 then
milaseconds = 0
seconds += 1
if seconds == 60 then
seconds = 0
minutes += 1
end
end
timer.Text = minutes .. ":" .. seconds .. "." .. milaseconds -- no bad spelling here
end
end
The timer ends up taking way too long, a second in the script is around 2.5 seconds irl. Can anyone please help me make this timer more accurate?
Thanks in advance :)

1 comment
I'd reccomend using RunService. It's faster and more reliable for things like these.