Basically, I have several parts that do the same thing when a user touches them. I have always dealt with this by doing something like this:
local Parts = game:GetService("Workspace").DesiredModelContainingParts--This obviously will change depending on what the parts are
for key,value in pairs(Parts:GetChildren()) do
value.Touched:Connect(function(Hit)
--do desired stuff
end)
end
I've used this style in studio with no problem, but I was wondering if it would work when multiple parts are being touched at the same time. I assume so because it should be the for loop should add a listener for each individual part. I prefer doing it this way because if I have a lot of parts performing the same function, it seems redundant to write the same function over and over.
