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()

5 comments
Why can't you just run a for i = x, y loop?
If i'm not wrong it's gonna stop once it meets those conditions. use a while true do loop
use while true do
I did use a while true loop but as I said then the until gets ignored. I want the fog to decrease until a certain value and then stop and repeat the next time
uSe HEarTbeAT!