var speed = 7.0; var rotateSpeed = 3.0; var Fireball:Transform; var iceball:Transform; private var dead = false; function OnControllerColliderHit(hit : ControllerColliderHit) { if(hit.gameObject.tag == "fallout") { dead = true; } } function Update () { var controller : CharacterController = GetComponent(CharacterController); transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0); var forward = transform.TransformDirection(Vector3.forward); var curSpeed = speed * Input.GetAxis ("Vertical"); controller.SimpleMove(forward * curSpeed); if(Input.GetButtonDown("Fire2")) { var bullit = Instantiate(Fireball, gameObject.Find("fireballspawn").transform.position,Quaternion.identity); bullit.rigidbody.AddForce(transform.forward * 2000); } if(Input.GetButtonDown("Fire1")) { var bullet = Instantiate(iceball, gameObject.Find("fireballspawn").transform.position,Quaternion.identity); bullet.rigidbody.AddForce(transform.forward * 2000); } } function LateUpdate() if (dead); { transform.position : Vector3(0, 4, 0) gameObject.Find("Main Camera").transform.position = Vector3(0, 4, -10); dead = false; } @script RequireComponent(CharacterController) The above is my script, and I am getting some errors which should not be there (I think): The true and false words are not changing colour. Assets/action_scripts/MoveAround.js(43, 17) BCE0044: expecting EOF, found `}`. This one is about the 2nd lowest line. Expecting `}`, found `gameObject`. This is about the 4th lowest line. Unexpected token `if`. This is about the 6th lowest line. I am using the Tornadotwins youtube tutorials, and my script is almost exactly the same as theirs. Any advice would be much appreciated.
You have if(dead) after the LateUpdate function, but before the brackets that compose its contents. EDIT: function LateUpdate() if (dead); { transform.position : Vector3(0, 4, 0) gameObject.Find("Main Camera").transform.position = Vector3(0, 4, -10); dead = false; } EDIT: also with your if(dead); formatted this way, it can't do anything. Put it inside the LateUpdate() function and remove the ; from it.