I just noticed that if you’re looping through all descendants, just check if “v” is a ClickDetector instead of checking if it is a BasePart, then checking if it has a ClickDetector.
for i,v in pairs(model:GetDescendants()) do
if v:IsA("ClickDetector") then
clickDetector.MouseClick:connect(onMouseClick)
end
end)
In that case the path might be wrong. Could you send a picture of your workspace (showing the top of workspace) and the open the folder along with other nested contents contents.
local model = game.Workspace.Folder
function onMouseClick()
print("You clicked me!")
end
for i,v in pairs(Folder:GetDescendants()) do
print(v.Name)
if v:IsA("ClickDetector") then
print("Step1")
v.MouseClick:connect(onMouseClick)
end
end)