How to insert 204,800 parts at once without roblox crashing.
I am making a terrain generator.
How to insert 204,800 parts at once without roblox crashing.
I am making a terrain generator.
Easy fix: This will never be possible without Roblox crashing.
That’s a heavy load to put on one clients device, and would get the same result as just putting the part down in the first place.
You should insert smaller amounts at a time with a task.wait()
inbetween
Try using meshes instead of parts; you might get better performance due to less poly’s needing to be rendered in.
You can also try to use PartCache.
That makes the terrain take a long time to generate. I want it to only take a few seconds.
I would still suggest something along the lines of what @Orbular3 suggested. You can either do one at a time or pre-defined sizes, whatever works best for your case.
wait() is roughly 1/30 seconds if I remember correctly, so if you did this, it would be almost 2 hours to generate all the terrain you need if you did one piece for every wait(). I understand that’s far too long.
But if our target time is a few minutes, and you did 20 parts per wait(), that’s about 5-6 minutes for your number of parts. If you can manage to do 40 per wait or more, you can cut it down to 2.5-3 minutes or less.
Alternative: Generate the terrain in studio, or have a set of “random” terrains generated, and keep them in server storage. Then, when you want them, instantly clone them out of server storage and into Workspace.
Why would you need the player to see all the terrain at once? Can’t you just load each chunk when a player goes close enough?
Cloning takes longer and is less performant than using Instance.new()
Every comment here is absolutely useless, and they just want to get the ‘solution’ mark for their profile. What you’ll really want to do, is use chunk based rendering depending on when a user is in that area (example: Chunk Loading System - Roblox). And one other way to help with performance is to use greedy messing, seen here Consume everything - how greedy meshing works
that is kinda offensive for some people to be honest you should go show your attitude in discord not on dev forum
You don’t need to be rude and this is exactly what I said in my first post. Please read the replies before insulting people.