Time math not working correctly


local player = game.Players.LocalPlayer
while wait(1) do
	local diff = tick()- player:FindFirstChild("Values"):FindFirstChild("NormalChestTime").Value 
	local timeBetweenClaims = 86400
	print(diff)
	if diff >= timeBetweenClaims then
		game.Workspace.Map["Starter zone"]["Daily chest"]["Daily Chest UI"].BillboardGui.TextLabel.Text = "Open chest"
	else
		game.Workspace.Map["Starter zone"]["Daily chest"]["Daily Chest UI"].BillboardGui.TextLabel.Text = tostring(os.date("%X",timeBetweenClaims - diff))
		print(timeBetweenClaims-diff)
	end
end


When I use this, it shows 19 hours instead of 24, but when i use 104400 as the value, it shows 24 hours. Why is it showing 5 hours less?

1 Like

Timezones, tick() will either use the local player’s time or the server’s time (depending on where it’s used).

So that is a local script, how could I use the server time there?

You need to get the time on the server and send it to the client.