Is there a way to detect if ClickDetector is parented to part even if they got the same name

image

 for i,v in pairs(workspace.MAP.Map["Game-Houses"]:GetChildren()) do
	if v:IsA("Model") then
		if v.Name == "Perm" then
			if v:IsA("Model") then
 				if v.Name == "Door" then
 					v.Part.ClickDetector:Connect(function()
 						print("i can't find the clickdetector")
					end)
 				end
 			end
 		end
 	end
 end

use GetDescendants() instead

for i,v in pairs(worksapce.MAP.Map["Game-Houses"]:GetDescendants()) do
if v:IsA("ClickDetector") then
print(v.Parent.Name)
end
end
2 Likes

You could try a for loop with :GetDescendants()