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
8 years ago

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

01wait(2)
02game.Lighting.Ambient = Color3.fromRGB(109 , 109, 109)
03game.Lighting.OutdoorAmbient = Color3.fromRGB(117, 117, 117)       
04 
05local Looping = 0
06 
07local OR = tonumber(game.Lighting.OutdoorAmbient.r * 255)
08local AR = tonumber(game.Lighting.Ambient.r * 255)
09 
10game.Lighting.Changed:Connect(function()
11    if game.Lighting.TimeOfDay == "17:30:00" then
12        repeat
13            wait(1)
14            AR = AR - 0.33333333333333
15            game.Lighting.Ambient = Color3.fromRGB(AR , AR, AR)
View all 94 lines...
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 — 8y
0
It has done the trick Simnico99 206 — 8y

1 answer

Log in to vote
0
Answered by 8 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

1while true do
2 
3end

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 — 8y
0
true Goldenkings11 -11 — 8y
Ad

Answer this question