Help with this script!

I have written a simple Sidescroller character control script, which apparently has the following errors:

Assets/Scripts/Platformer_PlayerControls.js(7,20): UCE0001: ';' expected. Insert a semicolon at the end.

and

Assets/Scripts/Platformer_PlayerControls.js(5,18): UCE0001: ';' expected. Insert a semicolon at the end.

Even though both lines have a semicolon at the end.

Here is the code:

//Platformer controls Script.
//Controls the Player.
//Attach this script to the Player Model, along with the CharacterController script.

var Speed : float - 6.0;
var JumpSpeed : float = 9.0;
var Gravity : float - 20.0;

private var moveDirection : Vector3 = Vector3.zero;

function Update () 
{


var Controller : CharacterController = GetComponent(CharacterController);
	if (controller.isGrounded)
	{
		//we are grounded, so recalculate
		//move direction directly from axis
		moveDirection = Vector3(0,0,Input.GetAxis("Horizontal"));
		//moveDirection = transform.TransformDirection (moveDirection);
		//controller.transform.LookAt();
		moveDirection *= Speed;

	if (moveDirection.sqrMagnitude > 0.01)
		transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (moveDirection), 1);


	if (Input.GetKey ("Jump"))
	{
		moveDirection.Y = JumpSpeed;
	}
	}

//Apply Gravity

moveDirection.Y -= JumpSpeed;

//move the Controller

controller.Move (moveDirection * Time.deltaTime);



}

Any help?

-Mike

Hey Mike,

If you’re trying to set it to be a negative number, you still need the = operator.

var Speed : float = -6.0;

That’s just a quick glance at those 2 lines themselves.

yup that fixed it :smile:

Thanks Ezzerland!