![]() ![]() This is because the condition is first evaluated then the code is run, which means the evaluation will happen, and then the code will run. Well, depending of the context, you might need to put it at the start of the function, but in general terms you should put it at the end. “But where do I place the wait?” you may ask. Okay, that’s better, but you are still relying on task.wait() returning something. Instead, use task.wait(): while task.wait() do ![]() Second of all, you are relying on a global function returning something, which you shouldn’t because that behaviour can always change. This is bad, first of all because wait() is horrible in every context, it shouldn’t be used at all. Run = false - Now we made the run to be false this should stop the loop cause run is not true –Now if we set run to False the loop will not run local Run = true While Run do - This checks if the argument run is true to then proceed with the function Here is an example to see if the argument given is true to run the while loop Print("Runing because the argument given is true") Wait() - You add a wait to not break or crash you device as this functioon runs so fast –//While true(Example) while true do - This function will only run if the given (argument) is true. –//While wait(Example) while wait(1) do - This function will run after every n(number) argument given. ![]() The difference between a “while true do” and a 2while wait() do" isĪ while true do -Loop with run when the the given argument is trueĪnd in a while wait() do will run after a given ammount of time ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |