I have programmed a world generator and
while true do
wait ()
end
already generates too much delay and ensures that the world is generated very slowly
I have programmed a world generator and
while true do
wait ()
end
already generates too much delay and ensures that the world is generated very slowly
local amount = 0
local MaxAmount = 20 -- 10,20,100
while true do
if amount+1 > MaxAmount then
amount = 0
wait() -- Set Amount
return
end
amount = amount+1
if amount == MaxAmount then
amount = 0
wait() -- Set amount
return
end
-- Do rest
end
Idk if this is what u were looking for but its what i thought u were so
nice explanation
cool. I once did this accidentally with it going 1000 times before wait () and my frames per second went down to like 1/2 but it didn't hang. Really annoying.
please properly indent your code.
This discussion is preserved as it was. New answers, comments, and votes are closed.
7 comments
You don't need to wait() after every iteration. You can do 10, 20, even 100 at a time without any problems. Just make sure it does eventually wait or it will hang.
Use a hearbeat wait?
Loading in chunks is definitely the way to go for this.
Absolutely chunks imo if your doing any kind of terrain generator
Unless you mean just the loading, in which case you can look into Network StreamingEnabled but read up on it because it effects a lot in local scripts
Take a look at RunService's Events => https://www.robloxdev.com/api-reference/class/RunService. And indeed, the above user''s suggestions are highly recommended. Nevertheless, the answer to your question can be found in RunService's Events; Stepped, Heatbeat or RenderStepped
A "faster" method without a wait will crash the server if it's a infinite loop.