So what I mean is can you do something like:
local table = {this,this1,this2}
if table.Children.Touched:Connect(fucntion()
etc
So if any of the descendants of the table are touched the script will fire.
So what I mean is can you do something like:
local table = {this,this1,this2}
if table.Children.Touched:Connect(fucntion()
etc
So if any of the descendants of the table are touched the script will fire.
###That is not how tables work. Items inside a table are not its children, but elements. You shouldn't name your table table as this may overwrite/be overwritten by the global variable called table.
###Use a for loop to iterate through its elements, and connect the Touched event to each element. Another thing, you cannot listen for an event within an if statement, that will throw an error.
local tab = {this, this1, this2}
for i = 1, #tab do
tab[i].Touched:Connect(function(part)
-- code
end)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.