Real Time not aligning?

Why is the real time not aligning in studio vs real game?

local time_zone = -5		-- Time zone, offset from GMT.

local tz_diff = 5*3600 + time_zone*3600
local secondsInDay = 60*60*24

while true do
	game.Lighting:setMinutesAfterMidnight(math.fmod(tick() + tz_diff,secondsInDay)/60)
	wait(0.1)
end

In studio the time will appear correctly:

while in the game it will appear a few hours ahead:

Why and how can I stop this from happening?


local timed;
local timeZone = 0 --0 = THE CURRENT TIME ZONE YOU ARE IN

local studio = false
if game:GetService("RunService"):IsStudio() == true then
	studio = true
end
	
while true do
	
	local hour, min, sec;
	local conversion;
	
	if studio == false then
		conversion = (math.floor((tick()/3600)%24 - timeZone)-5) 
		--[NOTE: for some reason the time is different in live game. So subtract 5 to match it up with real time.]
		
		if conversion < 0 then
			conversion = 24 + conversion
		end
		hour = conversion
	else
		conversion = (math.floor((tick()/3600)%24 - timeZone)) 
		if conversion > 24 then
			conversion = conversion - 24
		end
		hour = conversion
	end
	
	min = math.floor(((tick()/60)%60))
	sec = math.floor((tick()%60))
	
	timed = (hour .. ":" .. min .. ":" .. sec)
	print(timed)
	game.Lighting.TimeOfDay = timed
	wait(1)
end

Look into DateTime, this object will improve your experience.

It didnt.

ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ

ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ