Collision doesn't detect my "NoPlacePart" parts

I’ve recently worked on placing system but I wanted to make areas where you can’t place. For weird reason, my collision detector doesn’t detect what I want.

local function GetTouchingParts(part)
   local connection = part.Touched:Connect(function() end)
   local results = part:GetTouchingParts()
   connection:Disconnect()
   return results
end

function doesCollide(obj)
	local results = GetTouchingParts(obj)
	for _, v in pairs(results) do
		print(v)
		if v == "NoPlacePart" then
			return true
        else
            return false
		end
	end
end
1 Like

This is not the best way to go about scripting a placement system, I would suggest you use CFrames instead, a well made tutorial can be found here : Creating A Furniture Placement System

There is a method for doing this.
part:GetTouchingParts()

Your function doesn’t work because it needs physics to step for parts to become touching I believe.

But I am using collide false parts

Also, the GetTouchingParts function doesnt work if the object doesnt have CanCollide enabled. What you can do is set it to true while the item is being placed.

it works, it is an bypass for that for collide false parts

You can make parts CanCollide true for the frame that you run the detection. If this is too difficult, you may use some user made modules for region detection, which use a lot of complicated math.

Should I just make an ignore list?

The bad thing about this method is because the touched events are not completly accurate all the time, and this system does require accuracy, i would recommend you use math to do the region checking. @VitalWinter the math isnt that complicated just some simple vector and cframe math,

Capture


This is how it looks

When is GetTouchingParts not accurate?

sorry i meant the touched event.