Need Help! Issue with removing child from group

So i’m making a simple game (just like mario) and i’m trying to make an level editor. Right now I’m able to drag new objects from editor menu (which is a second scene) like this

and it’s working perfectly, I can add as many platforms as I want also I can drag them without any problems, to drag them I use code like this:
also i have a trashCan sprite and i have set an collider between this trashcan and my platform group which call this method
it’s working only if I destroy the newest child, if i decide to destroy the first one it also works but then when i want to drag other platforms i get an error in my for loop saying “platform.entries[i] is undefined” I tried some different approaches but not a single one seemed to work (usually i got the same error message) i’m not sure where i’m wrong here. I have no problems with sharing more of my code, or I can send you a link to my page where u can try the game a see the error itself

You need to splice the entries array, somehow matching obj to the array index.