Instatiate object after collision detect

Hi, I’m new to Unity and I’m trying to create a game where a basketball is shot at a target, and if it hits the target it disappears and respawns. I’ve got the script to make it disappear, but I now want to appear again after the collision. Here is my script so far:

function OnCollisionEnter(theCollision : Collision){

   if(theCollision.gameObject.name == "Target"){

   Debug.Log("Score!");

   Destroy(gameObject, 1);
   }
}

The basketball is stored in a prefab so I just need a way of making the prefab instantiate the basketball again. Can anyone help?

Instead of destroying it you can just use active.

e.g.

    function OnCollisionEnter(theCollision : Collision){
    
    if(theCollision.gameObject.name == "Target"){
    
    Debug.Log("Score!");
    
    gameObject.active=false;  }} 

Then when you want it back, you can simply use gameObject.active=true;