So im making a game, and just for fun im making a label that u can see the exact time the server is on
How would i make it so it display the time the server is on in a clock time, so like lets the server is on for 4 hours 30 minutes and 12 second it will display 04:30:12
Grab the os.time() first then when a server is started and you can reference current os.time() to the initial and format it using os.date(). Say:
local startTime = os.time()--server just started
while task.wait(1) do
print("server has been live for " .. os.date("!%X", os.time() - startTime))
end
You could also use os.difftime() instead of os.time() - startTime, but as we’re confident time is moving forward it shouldn’t be an issue for a counter like this.