Roblox > Scripting Lessons >

Lesson 5: While Loops

"While" loops are very similar to if statements except for that they are loops. The means that they will cause the things put in them to repeat as long as the condition is met. Here is the format for "while" loops:

while (equation) do
-- Insert Actions Here
end

The thing about while loops is that you must be sure that the loop will not go on forever. If a loop does go on forever with no wait time in the loop, the script will cause massive lag and could cause your place's servers to shut down or your computer to freeze up.

Again, if you have any questions be sure to ask me or Post on the Forums.

<- Previous Lesson  Next Lesson ->
Updated on Apr 23, 2010 by Ajedi32 (Version 7)
comments powered by Disqus