Unity not recognizing Instantiate? JavaScript

I am trying to make a gun that shoots the bullets i made. Yet, when i finish the script i get one error…which is


“Assets/GUN/Shoot1.js(14,34): BCE0023: No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(UnityEngine.Transform, UnityEngine.GameObject, UnityEngine.Vector3, UnityEngine.Quaternion)’ was found.”


Instantiate, for those who don’t know, is for cloning objects. :smiley:

Also this is the script…


#pragma strict

function Start () {

}
public var Bullet : Transform;
public var bulletSpeed : float = 6000;

function Update () {
if (Input.GetButtonDown(“Fire1”)) {
if (!Bullet || !bulletSpeed){
Debug.Log(“[Shoot] ‘Bullet’ or ‘bulletSpeed’ is undefined”);
} else {
var bulletCreate = Instantiate(Bullet, GameObject.Find(“SpawnPoint”),transform.position, Quaternion.identity);
bulletCreate.rigidbody.AddForce(transform.forward * bulletSpeed);
}

}

}

You’re passing four arguments to a function which expects a maximum of three. Of course that won’t work.

Look at this expression:

 Instantiate(Bullet, GameObject.Find("SpawnPoint"),transform.position, Quaternion.identity);

If I had to guess, you probably meant for the comma before transform.position to be a period.