Hello!
I have a real time day/night cycle in my game, where the sun rises in the morning and sets in the evening. It is coordinated to EST.
The sun rises at the right time of the day, but it sets way too early. The problem is, if I try to change the universaltime.hour it never works out correctly.
How do I fix this?
while true do
local dateTime = DateTime.now()
local universalTime = dateTime:ToUniversalTime()
universalTime.Hour -= 4
local estTime = DateTime.fromUniversalTime(universalTime.Year, universalTime.Month, universalTime.Day, universalTime.Hour, universalTime.Minute, universalTime.Second, universalTime.Millisecond)
game.Lighting.TimeOfDay = estTime:FormatUniversalTime("HH:mm:ss", "en-us")
wait(60)
end