Hello! I am making an island generation system and have a little problem.
When generating islands, my script uses a While loop. While testing my script had a bottleneck Wait() but when I was testing I accidently removed the wait and when I ran it it took a few seconds but then it was all generated.
To get to the point, While loop with a wait command takes 250x times longer then no wait command but it’s not a good practice to have no wait() command
Is it okay that I have no wait() or is there something I can do? The wait() makes the island probably take 15+ minutes whilst no wait makes it pretty much instant.
He’s asking if it’s a good idea to not have any yielding functions in a while loop.
@TheSleepyScripter for your answer, it’s simply no. If there’s no yielding in a repetitive code, it has a high chance to give out a script exhaustion execution error. To fix this, you can actually replace wait() with the new task library task.wait(). More info about it here.
It depends, if your while loop runs too long then it will be terminated for exhausting the timeout allocation, if your while loop runs long then add a yield, but if it doesn’t then it can work most likely without a yield