Hello! I am currently working on a block placement/generation system that generates quickly and only generates visible blocks. My problem is, when it goes through a dictionary of all the blocks in the world (Visible or not, so there are thousands) to generate only the visible blocks, it prints an exhaustion error, and when I add wait()s, it takes way too long to generate a single chunk. I am trying to be able to make this process almost instant if possible so the player will not have to wait a very long time for a single chunk to generate. I hope you can help and thank you for reading
You can try and union all the parts.
That would not work since there are different part types and they are models.
you might be able to split the dictionary into multiple shorter dictionaries and load them in bursts with a wait() in-between to keep a fast load speed without causing a script exhaustion
Why don’t you make a nested dictionary like this?
local chunkTable = {chunk1 = {part, group}, chunk2 = {mesh, part}
You would iterate over the different chunks and when you find the correct chunk show all it’s parts.
I have made a nested dictionary, however it still does not work, it still gets exhausted at a certain point.
Does it get exhausted looking through the chunks or loading the chunks? Could you maybe show some code?
It’s hard to know unless you post your code. There might be some ways to iterate over the blocks faster, but you’ll most likely have to come up with some optimizations, either by doing less each iteration or doing fewer iterations.