I keep getting an error message in the unity compiler and I need help solving it.

Hello I keep getting this error message: Assets/controlcube.js(23,1): BCE0044: expecting EOF, found ‘}’.

I have tried many things to solve this issue, such as changing up punctuation and trying out different scripts. This is what I put in the program.

#pragma strict
var speed : float = 6.0;
var jumpSpeed: float = 8.0;
var gravity : float = 20.0;

private var moveDirection : Vector3 = Vector3.zero;

function Update () {

moveDirection = Vector3(Input.GetAxis("Horizontal"), 0, 
                  Input.GetAxis("Vertical"));


moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;

if (Input.GetButton("Jump")) {   moveDirection.y = jumpSpeed;}
}

moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);

}

This is a very simple moving script for a project that I am making to improve my skills as a programmer. I am using javascript and I lack knowledge on the language but I am in the midst of learning. If you know what my problem is please leave a reply to help me. Thank you so much.

You’ve got two opening braces ( ‘{’ ), but three closing braces ( ‘}’ ). That won’t compile.

The rogue extra brace is after your if-check for the jump button. There’s one on the same line as the if, and one on the next.