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
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
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.
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.
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,