I am having trouble with finding a way to make it so when I attempt to place a model inside another model, I prevents it. Basically, the system creates a fake model that appears at the mouse locally and I want a way to detect if it is touching something from inside a folder. How would I go about doing this? If you need more information, just ask! Thank you in advance!
You can use the GetPartsInPart method to detect if any parts are overlapping.
1 Like
I think I may be doing something wrong. Here is my code. It prints nil instead of the touching part.
local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Blacklist
overlapParams.FilterDescendantsInstances = {workspace.Placeable}
local touchingParts = workspace:GetPartsInPart(CurrentDecoy.Outline, overlapParams)
print(touchingParts.Name)
Do you want to test of Placeable is overlapping CurrentDecoy.Outline? Try setting it to whitelist instead
Nevermind, I made a mistake, here is the working script:
local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Blacklist
overlapParams.FilterDescendantsInstances = {workspace.Placeable}
local touchingParts = workspace:GetPartsInPart(CurrentDecoy.Outline, overlapParams)
for _, v in pairs(touchingParts) do
print(v.Name)
end
I was supposed to loop through the parts, not try to get the name of the array.