destroy child object

i have wrote my script and it comes up with no errors. on collision with “Player” it is suppose to destroy the child object and it is not, here is the script

#pragma strict
 function OnCollisionEnter(myCol: Collision){
     
     if(myCol.gameObject.tag == "Player"){
    var child = transform.GetChild(0);
    GameObject.Destroy(child.gameObject); 
       }
 }

why does this not work?

thanks

Is it possible to child.gameObject.SetActive=false?

Try changing Destroy with DestroyImmediate (just for testing, don’t leave it to your final code)