What's a effective way to check if a Part (Brick) is surrounded by other brick.
Such as in the game "The Quarry" when you mine a block another block is added to the side of the block that is mined giving the illusion that the mine is endless.
Awhile back, I noticed the same thing in the Quarry. But I noticed it in a different sort of way. If you reach to the spots in between the layers(dirt,stone,granite,obsidian) then you'll notice that if you mine a block down below the layer then all the blocks surrounding it will turn into the next layer type, whilst if you were to just mine to the side they're the previous layer type. This is mostly noticable with the intersection between granite and obsidian(if you play the game enough to get that far)
A way to implement this feature is to make a function that checks every part in the workspace and compare the magnitude, since presumedly if the part were to be right next to the focus part, then the checking value should be less than or equal to 1.
I'm not sure if this is the most efficient way but it works.
function checkDist(model,part) for i,v in pairs(model:GetChildren()) do if v:IsA("BasePart") then if (v.CFrame.p - part.CFrame.p).magnitude <= 1 then return v; end end if #v:GetChildren() > 0 then checkDist(v) end end end local closestPart = checkDist(workspace,workspace.Part) if closestPart ~= nil then closestPart.Transparency = 0 --idk lol, do whatever you want else local p = Instance.new("Part",workspace) --Define Properties here-- p.CFrame = CFrame.new(workspace.Part.CFrame.p + Vector3.new(-p.Size.X,0,0)) end