The problem I'm having with my script is that on the second cycle of the moon, it permanently sets the outdoor ambience and ambience to the dark version and does not fix itself. As well as that I would appreciate tips on how to make it a smoother transition. Here is the code I'm having trouble with.
local MinutesAfterMidnight = 0
while true do
game.Lighting:SetMinutesAfterMidnight(MinutesAfterMidnight)
MinutesAfterMidnight = MinutesAfterMidnight + 10.5
wait(0.1)
if MinutesAfterMidnight >= 6 * 60 and MinutesAfterMidnight <= 18 * 60 then
game.Lighting.Brightness = 1
game.Lighting.OutdoorAmbient = Color3.new(97/255, 97/255, 97/255)
game.Lighting.Ambient = Color3.new(5/255, 5/255, 5/255)
end
if MinutesAfterMidnight >= 18 * 60 or MinutesAfterMidnight <= 6 * 60 then
game.Lighting.Brightness = 0
game.Lighting.OutdoorAmbient = Color3.new(5/255, 5/255, 5/255)
game.Lighting.Ambient = Color3.new(2/255, 2/255, 2/255)
end
end
As a side note after looking at the world lighting while running it, on the second moon cycle the OutdoorAmbient and Ambient did not change when the sun came up. Also the sky itself seemed to have darkened halfway through the night.

2 comments
Bad idea, it won't even change. Time passes just fine with the code I have, it's the loop itself when it comes to changing the Ambient and OutdoorAmbient that's the problem.
Never mind I just found the solution! It turns out I needed to use an if statement to reset the MinutesAfterMidnight back to 0 if it greater than or equal to 1440 or 24 * 60. Thanks for trying to help though! :)