You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make a timer that counts up like this 00:00.00
What is the issue? Include screenshots / videos if possible!
I can’t seem to make this happen.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I looked on youtube and the developed hub but I couldn’t find a topic like this.
The server script
Im mobile so i dont have the lua characters
game.Players.PlayerAdded:Connect(function(plr)
local stat = Instance.new(“IntValue”)
stat.Name = “time”
stat.Parent = plr
while wait (0.01) do
stat.Value = stat.Value + 1
end
end)
put this under a local script inside of a textlabel:
local milisecond = 0
local second = 0
local minute = 0
local hour = 0
while wait(0.01) do
if milisecond >= 60 then
milisecond -= 60
second += 1
end
if second >= 60 then
second -= 60
minute += 1
end
if minute >= 60 then
minute -= 60
hour += 1
end
milisecond += 1
script.Parent.Text = hour..":"..minute..":"..second.."."..milisecond
end
I would recommend against this method, as using wait(0.01) could cause problems. wait() is known to have problems with it not correctly waiting for the small amount of time like 0.01. I suggest you re-implement this solution with something like tick().
Well how many players did you have in your testing? How many things were going on? I’m saying that I myself have had problems using wait(), and I am simply suggesting that tick() is a safer solution that can have more decimal places if ever necessary in the future, and it’s usage is actually meant to count time in seconds.
even so, its local so it wouldnt cause any lag as it doesnt run other peoples timer. It does not have any problems at all, I get that in different ways tick() can be better but for this its perfectly fine and as for “wait having problems with small numbers” it with something like this. It only has problems with small numbers if you’re having a lot of things running from it within that short time.