Detect if Part is touching any part that is inside a table

So i made a function to detect if a part is placeable, if the part is not touching any parts inside the CantTouch table, then it is placeable, otherwise it isnt, but if CanQuery is off then this will not work. Any ideas how to do this, with raycasts perhaps?

function isPlaceable(Prop)
	local TouchingParts = workspace:GetPartsInPart(Prop)
	local CantTouch = {}
	for i, v in pairs(game.Workspace.Nodes:GetChildren()) do 
		table.insert(CantTouch, v.Zone)
	end
	for i, v in pairs(game.Workspace.NodeBarricades:GetChildren()) do 
		table.insert(CantTouch, v)
	end
	for i, Part in pairs(TouchingParts) do 
		if table.find(CantTouch, Part) then
			return false
		end
	end
	return true
end
1 Like

Why does CanQuery need to be off?

The whole point of CanQuery is that it ignores things like raycasts :sob:
You might be able to use :GetTouchingParts() and then check if anything in the CantTouch list is in there. I don’t know if this would work much different from your current approach, though.

So the block can be placed inside

That’s gonna achieve the same thing i wrote in the function above? I also need a function to check if a part is inside another part (a building zone part) and this one to check if part is only touching that zone.