Script for real time to in game time not working right

I am trying to make the in game time match my time in real life.

My issue is that when I run it in studio it works and when I run it on the roblox client it sets the time wrong. Pictures: InGame|566x500 InStudio|465x454

I have tired other ways of doing this including trying a different api.

My code for my script is below.

while true do wait(1)
	local HttpService = game:GetService("HttpService")
	
	local URL_TIMECST = "http://worldtimeapi.org/api/timezone/America/Chicago"
	
	local response = HttpService:GetAsync(URL_TIMECST)
	
	local data = HttpService:JSONDecode(response)
	
	local response = HttpService:GetAsync(URL_TIMECST)
	local data = HttpService:JSONDecode(response)
	
	local stringToFormat = "%X"
	local timestamp = data.unixtime
	local result = os.date(stringToFormat, timestamp)
	
	game.Lighting.TimeOfDay = result
end

In studio, the server uses the timezone that you are in. So the timezone for the client and the server are the same.

However, in the actual game, the server uses UTC while the client uses the timezone set on their OS. This might be why?

os.date formats using os.time if a timestamp is nil or not provided, maybe this is the issue, try to debug the script using print() in certain places.