You can write your topic however you want, but you need to answer these questions:
I want a timer that counts up from 0 to inf even after someone leaves for example 1 hour and then join back i want the timer to be an hour higher
i cannot find someone talking about this anywhere
My script currently is =
local startTime = os.time()
local TextLabel = script.Parent
local function sToHMS(s)
local h = math.floor(s/3600)
s = s % 3600
local m = math.floor(s/60)
s = s % 60
return string.format("%02i:%02i:%02i", h, m, s)
end
game:GetService("RunService").RenderStepped:Connect(function()
TextLabel.Text = sToHMS(os.time() - startTime)
end)
Yeah! the script you shared does not need to be “running” the time elapsed is calculated on-use, as long as you save to a datastore the timestamp method will work nicely. You will need to keep track of saveTime on the server (Script instead of LocalScript) to save it.
I wouldn’t use a data store, if they are trying to count up from a specific point in time (e.g how long has it been since last Christmas, for example), then I would just find the os.tick value for that date and use that as a constant
e.g.
local startTime = 4928482
local TextLabel = script.Parent
local function sToHMS(s)
local h = math.floor(s/3600)
s = s % 3600
local m = math.floor(s/60)
s = s % 60
return string.format("%02i:%02i:%02i", h, m, s)
end
game:GetService("RunService").RenderStepped:Connect(function()
TextLabel.Text = sToHMS(os.time() - startTime)
end)
The start time I put was a random number, but you can put it as whatever you want