How to get attachments inside a part/zone

What can I do to get all the attachments inside a part/zone? I don’t mean how can I have the attachments that are descendants of a part/zone, but literally the ones that are inside.

I did not find something similar in the DevForum.

1 Like
function isInsidePart(position, part)
	local v3 = part.CFrame:PointToObjectSpace(position)
	return (math.abs(v3.X) <= part.Size.X / 2)
		and (math.abs(v3.Y) <= part.Size.Y / 2)
		and (math.abs(v3.Z) <= part.Size.Z / 2)
end

local isAttachmentInPart = isInsidePart(attachment.Position, part)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.