I have an array storing x parts, where many of these parts get destroyed. How can I get a part from this array that’s not nil, so that didn’t get destroyed?
I’ve tryed to remove the parts from the array whenever they get destroyed, and it works fine, but I’m curious to know how to get a non nil part from the array.
Thanks in advance!
Here’s the deal, so if you index a part that you destroy that’s also stored in an array, like so-
print(table[x])
Even if the physical instance of the brick is destroyed, that should still print the object itself. This is because the part is still being referenced by the table directly, and therefor that object is still in memory, although the parent of the object has been locked and set to nil, as is what :Destroyed() does when it’s called.
So with that being said, just check to see if its parent is set, like so: