Problem with tutorial script

im using the tutorial from the tornado twins but when i put in the script to shoot my fireball (video 5) it wont go to gameplay so i did something wrong but idk what so can someone paste the script for me.

This code was absolutely full of errors! The compiler will not run if there are errors in a script.

You were using two quotation marks instead of one double quotation mark to define your GetButtonDown and your GameObject.Find. Also, a tip: don’t use GameObject.Find in Update(); it is pointlessly expensive. Instead use it in either Awake() or Start() because the GameObject.Find will only need to reference that object in a variable once in order to define it. Here is the reformatted code:

var speed : float = 3.0;
var rotateSpeed : float = 3.0;
var bullitPrefab : Transform;
private var controller : CharacterController;
private var spawnPoint : GameObject;
@script RequireComponent(CharacterController)

function Start () {
controller = CharacterController = GetComponent(CharacterController);
spawnPoint = GameObject.Find("spawnpoint");
}

function Update () {
// Rotate around y - axis
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);

// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);

if(Input.GetButtonDown("Jump")) {
    var bullit = Instantiate(bullitPrefab, spawnPoint.transform.position, Quaternion.identity);
	}
}

Good luck, Klep

Edit: Code was edited due to @aldonaletto noticing some errors in my code. See comment below for info. Thanks!

This code has some errors and missing instructions:

  • A double quote is the character ", not two single quotes!

  • Most functions in Unity are case sensitive, so check if “jump” and “spawnpoint” are correctly written (the standard button name is “Jump”).

  • You must apply a force or set the rigidbody velocity to make the bullit move - this part of the code is missing.

The fixed code should be:

...
if(Input.GetButtonDown("Jump")) // check the spelling
{
    var bullit = Instantiate(bullitPrefab, GameObject.Find("spawnpoint").transform.position, Quaternion.identity);
    bullit.rigidbody.velocity = forward * 20.0; // set the bullet speed
}