NOTE: I’m not a professional scripter, i’m more into building and graphics designing.
Anyways, i’m starting a game of my own and I want the game time to be based on San Diego, California’s actual time - the day and night script would be synchronized to San Diego’s timezone. If anyone can help me with a script for this I would be very grateful.
I would say use os.time for this functionality, I use os.time for bans and it’s very effective but for daylight cycle based on actual time can be done.
As what @Mister_Roadgeek said, yes, use os.time for this.
Including the loop and formatting it, this must work since I had tested this.
local rs = game:GetService("RunService")
rs.Heartbeat:Connect(function()
local Time = os.time() - (7 * 3600) -- UTC time, offsetted to San Diego, California.
local date = os.date("!*t", Time) -- date table
local result = string.format("%02d:%02d:%02d", date.hour, date.min, date.sec)
game.Lighting.TimeOfDay = result
end)