No appropriate version of 'UnityEngine.Object.Instantiate. Please Help :(

Hi i am creating a basic game where you shoot basketballs into a box. I am seeming too have an error with one of my scripts that deals with destroying the basketball once it has gone in the box and re spawning it the error is:

Assets/ContactRespawn.js(7,43): BCE0023: No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(System.Type, UnityEngine.Vector3, UnityEngine.Quaternion)’ was found.

here is the code:

pragma strict
var thePrefab = GameObject;

function OnCollisionEnter(theCollision : Collision) {
   if(theCollision.gameObject.name == "Plane") {
   Destroy(gameObject.Find("Sphere"), 1);
   var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation);
   } else if(theCollision.gameObject.name == "Hole") {
   Destroy(gameObject.Find("Sphere"), 1);
   var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation);
   }
}

Any help would be great thanks :slight_smile:
P.S. i am mildly experienced with coding

line 2:

var thePrefab = GameObject;

should be

var thePrefab : GameObject;