Hello! Recently I made a mining system that creates parts whenever you destroy other parts.
As you can see in the video, it doesn’t really work that well, because it takes a lot of time to detect new parts (since I save all of the part’s positions, every new part forces the script to look through hundreds of others, which takes time)
I was thinking of creating a Region3 to detect parts, something like this:
That’s what I currently use. I also save all block’s location in a folder in serverstorage, and look for them everytime to check if they are there, which causes the block overlap, I heard a region3 small check could do the thing, idk how to do it though
What does the code that handles checking previous locations and spawning new minerals look like? I’m guessing (mostly based off what was shown) you’re aiming for a system that dynamically loads in blocks around the player as they’re revealed (rather than generating it all at once)?
So if I understand this correctly, the problem is that when you mine a block, it might cause a new block to spawn in a loaded block? In that case, you should save your blocks in a 3D table. This way, you will be able to index the blocks variable, which is much faster than an iterative approach. You should not try to get through a locked door with brute force when you simply have the key at your disposal.
// Pseudo code (actual code will look differently, but this will give you an idea)
if blocks[x][y][z] then
// The block already exists
end