When scripting there are varies of loop type to use. They all have different properties. I commonly use while loops, and I use them too much. And that’s bad for the game because they run around 30 hertz or more if not used carefully. I wonder if all other loops do the same.
All these loops have different uses. None are really better for performance than another.
While loops are used for keeping a condition running. For is for iterating through an array, table or numbers. Repeat is usually used for yielding a script.
In my opinion it depends on what they do. If you think you ain’t going to need the while loop anymore just break it. for loop is very different, in my opinion is not a loop by the way. I use repeat loops a lot. Well, as I said I think the lag comes when executing expensive code really fast. (Sorry if I didn’t explained myself well)
They’re different loops and they have different purposes. Performance doesn’t depend on the type of loop you’re using necessarily, it depends on what you’re doing in each iteration. If your code is expensive and you’re running that in quick succession, expect lag.
Use some of Studio’s debugging tools to help you determine the performance of each iteration.