#how do i prevent 2 things of the same parent of going into the same table

1 messages · Page 1 of 1 (latest)

azure pebble
#

i have a bit of code that when a hitbox touches something it gets added to a table. but when it touches 2 things part of the same model it adds both. and i need to figure out how to not add it if its part of the same model

hitbox.Touched:Connect(function(t)
    table.insert(touching,t)
end)

hitbox.TouchEnded:Connect(function(t)
    table.remove(touching,table.find(touching,t))
end)

heres the code:)

warped jasper
#

just check their parents

hollow zinc
#

you would say if table.find(touching, t) then dont add

warped jasper
#

like if the table looks like {Part1, Part2} and you want to check something new then loop through the table, check if the parts parents are a model, and if so check if the parts parent is equal to the new part parent, if this is true then you dont add it

#

make sense?

#

tell me if that works

azure pebble