Mine Generation not always deleting each block

It has a quite weird behaviour.


for i, v in pairs(Mine1:GetChildren()) do
			if v:IsA("BasePart") then
				local _2 = MyVectorTable
				local _3 = v.Position
				
				_2[#_2 + 1] = _3
				
			end
		end

This iterates through the mine folder and adds a new block pos to MyVectorTable.


local positions = { Vector3.new(6, 0, 0), Vector3.new(-6, 0, 0), Vector3.new(0, 6, 0), Vector3.new(0, -6, 0), Vector3.new(0, 0, 6), Vector3.new(0, 0, -6) }

These are all the blocks that will be added. (MiningBlock.Position + the element)

I iterate through positions and add MiningBlock.Position + the element). After that I check if the PosY is greater than 0. After that I check if the NewPosition (MiningBlock.Position + the element)) already exist. After that if its not any of them, it will only make a block and add to the vector table.

Do you have any parts inside other parts/folders/models?
Try this:

for i, v in pairs(Mine1:GetDescendants()) do
    if v:IsA("BasePart") then
        local _2 = MyVectorTable
        local _3 = v.Position

        _2[#_2 + 1] = 3
    end
end

GetDescendants() will get all children even if they are in subcategories such as folders, models, etc.

That didn’t do anything. Gives the same behaviour.

Are there other types of objects such as a MeshPart in ‘Mine1’?

Fixed. I did a math error. I only checked if PosY is greater than 0 and never said if its greater or equal to 0.