(JAVASCrIPT) it says that "var" is the wrong token! HELP!

var SimplebulletPrefab:Transform;

function Update () {

    if(Input.GetButtonDown("Jump"));
    } 

    var SimplebulletPrefab : Instantiate(SimplebulletPrefab, GameObject.Find("Spawnpoint").transform.position, Quaternion.identity);

var is only used when declaring the variable. afterwards when calling it, you just type the name of the variable, omitting “var”.

Also, the rest of your code is completely dysfunctional.

Here’s the cleaned up code:

var simpleBulletPrefab : Transform;

function Update()
{
   if(Input.GetButtonDown("Jump"))
   {
      Instantiate(simpleBulletPrefab, transform.position, transform.rotation);
   }
}

After the if statement and before the bracket, do not put a semicolon. Even if it got along with Unity, it’d be telling it that it was the end of that line, and anything after was to be carried out every frame (due to function Update():wink:

I don’t know why you’re looking for “Spawnpoint” as a place to spawn. Just say “transform.position”, and it will spawn in the position of the object the script is attached to.

For some reason, I want to say you borrowed code from the “Lerp” tutorial?

Your syntax is completely wrong. You never open the braces for the if statement, you have a semicolon after the if statement and you try to declare the same variable twice and in the second declaration you use a colon instead of an equals sign.

This should work:

var SimplebulletPrefab:Transform;

function Update () {

    if(Input.GetButtonDown("Jump")) {
        Instantiate(SimplebulletPrefab, GameObject.Find("Spawnpoint").transform.position, Quaternion.identity);
    } 
}