So I have about 24 parts and they will all have their own function when they are touched. Instead of writing out 24 lines of
part1.Touched:connect(function..... end)
part2.Touched:connect(function..... end)
part3.Touched:connect(function..... end)
is it possible to have a table such as
parts = {part1, part2, part3}
And then have a function such as
parts:GetChildren().Touched:connect(function(child, part)... end)"
Because obviously I'd want to know what part was touched, and what touched it.
This is all in a server script, and I'm also not sure if it'd function properly with multiple players on a server because I haven't scripted in about 2 years, I forgot... So if 8 people were on the server would they all use the same 1 script and mess up the variables? Or would it replicate and run 8 times individually for each player? Thanks!
Tom

2 comments
This is certainly possible, but it might not be any better if you want each part to do a different thing when touched.
I actually want every part to start or stop a timer depending on variables when it was touched, but I am really lazy and I couldn't be bothered to make a smart script. How would I go about doing it in more detail?