Hey guys, so I've been trying to write a script that slowly fades fog in and out. It already works pretty well, I also made a script that makes a day/night cycle. The fog creeps in at 4 am and creeps out at 9. Except it only works once. After a "roblox day" it stops working. That's why I need help. When I loop the "repeat" loop, the "until" gets ignored and the values of the fog keep subtracting up for infinity when it should stop at the values I set.
This is the function that starts the fog. Hope someone can help.
function nevoeirostart() repeat wait(0.1) if game.Lighting:GetMinutesAfterMidnight() > 4 * 60 then game.Lighting.FogStart = game.Lighting.FogStart - incremento2 end if game.Lighting:GetMinutesAfterMidnight() > 4 * 60 then game.Lighting.FogEnd = game.Lighting.FogEnd - incremento1 end until game.Lighting.FogStart < 50 and game.Lighting.FogEnd < 450 end wait(0.1) nevoeirostart()