Hello Roblox, just a simple request this time, is there any possible way I can make a while loop without a yield or a wait?
for I, v it loops through a table
Use task.Spawn or Coroutines to not yield the code.
Is there a reason for this? Usually its dangerous for resources to leave infinite loops running without some sort of yield for other code to run in.
A while loop won’t yield unless you explictly have code inside that yields, such as a wait() or any of the API functions that internally yield (e.g. WaitForChild on something that doesn’t already exist).
coroutine.wrap(function()
-- loop
end)()
I am trying to make an AI that can generate any object made by the Roblox account but its extremely slow so I am using a loop, I want to remove all the yields to make it faster but all the replies haven’t worked.
Generally you only need to yield once per 5 seconds or so (otherwise Roblox will terminate your script for not yielding). The probelm with that is that you essentially freeze the entire engine, so you need to yield often to not create lag. Plugins often don’t yield and freeze Studio for this exact reason (although it can be justified - you may want your plugin to not be interrupted while doing work).
I replied someone with this ^^^
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.