Loops? Ok.. Here are some example loops (Sorry if didn't help);
repeat until nil
1.This repeats a loop non-stop (see 3 for more information), but if you want it to stop at a certain point;
repeat wait(0)script.Parent.Value=script.Parent.Value+1 until script.Parent.Value=100
2.For this one, It will repeat until the value equals to 100.
3.But if you take away 'script.Parent.Value=100' to 'nil', then the loop will never stop until something other occurs, like an error.
4.There is also while true do end
. Like repeat until nil
, but a bit different. Here is an example of a while true do end
loop;
while true do wait(0) print("Everything is awesome!") end
5.It will repeatedly print Everything is awesome!
non-stop until script is removed or disabled. :P
6.But there is a way to break the while true do end
loop, add break
into the while true do end
statement, and this'll happen;
while true do wait(0) print("Everything is awesome!") break end
7.As you'll see, it'll only print Everything is awesome!
once, because break
breaks a loop, same with for LOL=1,9 do end
8.Surprized you can use for
for a loop? Here is an Example of one;
for i=1,9 do wait(0) print("Everything is awesome!") end
9.As you'll see, it'll print Everything is awesome!
9 times, unless there is a break
(see 6 and 7 for more information)
I hope this helped!
Locked by TheeDeathCaster and BlueTaslem
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?