✓ Accepted answer
To repeat an area of code you use a loop. In this case, a while loop should be used.
while loops take the form of,
while condition do
end
If the condition is met, it will repeat itself until the condition is not met.
If the condition is met, we say that the condition is true. If it is not met, we say that the condition is false. In while loops, the condition must be true in order to continue with the loop.
So how do we make something loop continuously? Well, all we must do is give the while loop a condition that will never be false. This could really be any number of things, but a fool proof way to give a loop a condition that will always be true is to give it true itself!
while true do
end
Obviously, if we give the loop true as the condition, it will never equal false. Now we have an eternal loop.
CAUTION: Eternal loops must have at least a wait() somewhere inside them or they will crash the game.
Take a look at these questions concerning while loops;
Do the following while what is true?
What is while true do?
What does while true do mean?
They have some very good explanations.
2 comments
I've tried 'Repeat until' but I don't know what to put after the until...
I edited my post with some more questions about while true do! Take a look at them!