I changed the code with deBUG
Here i constructed the arrays, each array object with your own player_id variable
Here i Call the function
The Function try destroy the object, a debug way
this image shows the function that can not find the object array comparing the object variable with param(1)
(the array object was not destoyed)