I have a model and inside that models is four more models and inside those models are bricks , and inside some of the bricks have clickDetectors, now I could just put a script in each clickDetector but I don't find the efficient. How could I make all clickDetectors work on one single script without having to do like three for loops?
I tried this, it works, but I don't think its very efficient.
for i,v in pairs(workspace.Mannequins:GetChildren()) do
for d,g in pairs(v:GetChildren()) do
for p,n in pairs(g:GetChildren()) do
--code
end
end
end
I would do this on the client and use player.Mouse.Target, but I wish to keep this code on the server to it can't get stolen (FE is ON)

3 comments
If you know the names of each of the clickdetectors, then just use workspace.Mannequins:FindFirstChild("ClickDetector", true)
I won't becuase eventually there will be around 100-200 models inside that one main model.
you could make a module script. return what mannequins click, and do the actions you need to do. but since you said you're making 100-200, you might not feel like making 100-200 scripts calling 1 module script :P