Hello everyone, I have a problem with my millisecond timer. I don’t know what exactly is the problem but that’s a script I use and as result something doesn’t work correctly. After in game round repeats timer to count from 0 for several times, timer starts to count time slower and slower every round. I’d like to achieve a normal millisecond timer that doesn’t change any speed of counting while looping a server script.
So this is my ‘timer’ script:
local status = game.ReplicatedStorage:WaitForChild("Status")
local ingame = game.ReplicatedStorage.Ingameplayers
while true do
repeat wait() until status.Value == 'GO!'
local Minutes = 0
local Seconds = 0
local Milliseconds = 0
while true do
repeat
local passed = wait()
Milliseconds = Milliseconds + math.ceil(passed)
status.Value = (Minutes..":"..Seconds..":"..Milliseconds)
until Milliseconds > .99
Seconds = Seconds + 1
status.Value = (Minutes..":"..Seconds..":"..Milliseconds)
if Seconds == 60 then
Minutes = Minutes + 1
Seconds = 0
status.Value = (Minutes..":"..Seconds..":"..Milliseconds)
end
if Minutes == 60 then
Minutes = 0
status.Value = (Minutes..":"..Seconds..":"..Milliseconds)
end
if ingame.Value == 0 then
status.Value = '50:0:3000'
end
if status.Value == '50:0:3000' then
wait(0.2)
status.Value = 'Out of time!'
break
end
end
end
I don’t get any error or anything. I had thoughts that maybe a while true do
makes some messed up here but I am not really sure. I tried to remove the first while true do but script doesn’t repeat every round so game brokes and status value is set to ‘GO!’ and nothing changes. I also tried to call it with RemoteEvents but I can’t because I have both written in a script. I don’t really understand why this happens so if anyone understands, please feel free to reply to this topic. If you have any questions about script let me know.