Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why the variable looping won't increment?

Asked by
Simnico99 206 Moderation Voter
7 years ago

When i do print(Looping) its printing 1 and doesn't augment every time it does loop


wait(2) game.Lighting.Ambient = Color3.fromRGB(109 , 109, 109) game.Lighting.OutdoorAmbient = Color3.fromRGB(117, 117, 117) local Looping = 0 local OR = tonumber(game.Lighting.OutdoorAmbient.r * 255) local AR = tonumber(game.Lighting.Ambient.r * 255) game.Lighting.Changed:Connect(function() if game.Lighting.TimeOfDay == "17:30:00" then repeat wait(1) AR = AR - 0.33333333333333 game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR) Looping = Looping + 1 until Looping == 29 game.Lighting.Ambient = Color3.fromRGB(99 , 99, 99) OR = tonumber(game.Lighting.OutdoorAmbient.r * 255) AR = tonumber(game.Lighting.Ambient.r * 255) elseif game.Lighting.TimeOfDay == "18:00:00" then repeat wait(1) AR = AR - 1.3666666666666666666666666666667 OR = OR - 1.7 game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR) game.Lighting.OutdoorAmbient = Color3.fromRGB(OR , OR, OR) Looping = Looping + 1 until Looping == 29 game.Lighting.Ambient = Color3.fromRGB(58, 58, 58) game.Lighting.OutdoorAmbient = Color3.fromRGB(66, 66, 66) OR = tonumber(game.Lighting.OutdoorAmbient.r * 255) AR = tonumber(game.Lighting.Ambient.r * 255) elseif game.Lighting.TimeOfDay == "18:30:00" then repeat wait(1) OR = OR - 1.333333333333333333333333333 AR = AR - 1.333333333333333333333333333 game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR) game.Lighting.OutdoorAmbient = Color3.fromRGB(OR , OR, OR) Looping = Looping + 1 until Looping == 29 game.Lighting.Ambient = Color3.fromRGB(18 , 18, 18) game.Lighting.OutdoorAmbient = Color3.fromRGB(26, 26, 26) OR = tonumber(game.Lighting.OutdoorAmbient.r * 255) AR = tonumber(game.Lighting.Ambient.r * 255) print("Bruh!") elseif game.Lighting.TimeOfDay == "19:00:00" then repeat wait(1) AR = AR - 0.6 OR = OR - 0.9 game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR) game.Lighting.OutdoorAmbient = Color3.fromRGB(OR , OR, OR) Looping = Looping + 1 until Looping == 29 game.Lighting.Ambient = Color3.fromRGB(0 , 0, 0) game.Lighting.OutdoorAmbient = Color3.fromRGB(0, 0, 0) elseif game.Lighting.TimeOfDay == "05:00:00" then repeat wait(1) AR = AR + 1.6666666666666666666666666666667 OR = OR + 1.7833333333333333333333333333333 game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR) game.Lighting.OutdoorAmbient = Color3.fromRGB(OR , OR, OR) Looping = Looping + 1 until Looping == 29 game.Lighting.Ambient = Color3.fromRGB(50 , 50, 50) game.Lighting.OutdoorAmbient = Color3.fromRGB(53.5, 53.5, 53.5) elseif game.Lighting.TimeOfDay == "05:30:00" then repeat wait(1) AR = AR + 1 OR = OR + 1.45 game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR) game.Lighting.OutdoorAmbient = Color3.fromRGB(OR , OR, OR) Looping = Looping + 1 until Looping == 29 game.Lighting.Ambient = Color3.fromRGB(80 , 80, 80) game.Lighting.OutdoorAmbient = Color3.fromRGB(97, 97, 97) elseif game.Lighting.TimeOfDay == "06:00:00" then repeat wait(1) AR = AR + 0.96666666666666666666666666666667 OR = OR + 0, 66666666666666666666666666666667 game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR) game.Lighting.OutdoorAmbient = Color3.fromRGB(OR , OR, OR) Looping = Looping + 1 until Looping == 29 game.Lighting.Ambient = Color3.fromRGB(109 , 109, 109) game.Lighting.OutdoorAmbient = Color3.fromRGB(117, 117, 117) end Looping = 0 end)
0
Where did you put the print statement? You are saying it only prints '1'? (I don't understand how that can be.) Also, instead of "repeat until Looping == 29", consider using a 'for' loop, ex: "for Looping = 0, 29 do". I'm wondering if comparing TimeOfDay to a specific string might have something to do with the problem. chess123mate 5873 — 7y
0
It has done the trick Simnico99 206 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Instead of in between repeat and until I would try deleting that and making the next like wait(5 or a number) and the part you want to loop in a

while true do

end

while true do means loop which loops the script forever

or if that don't work try using the same script just the part you want to loop place the while true do script and place an end at the end of the script.

0
Although while true do would be guaranteed to make the script stay in the loop more than once, it's really just another form of "repeat until". chess123mate 5873 — 7y
0
true Goldenkings11 -11 — 7y
Ad

Answer this question