Ball Jumping Script Doesn't work.

My Code:

#pragma strict

var rotationSpeed = 100;
var jumpHeight = 8;

private var isFalling = false; 

function Update () 
{
   // Handle Ball Rotation.
   var rotation : float  = Input.GetAxis ("Horizontal")  * rotationSpeed;
   rotation *= Time.deltaTime;
   rigidbody.AddRelativeTorque (Vector3.back * rotation);
   
  if (Input.GetKeyDown(KeyCode.W && isFalling == false ) 
  {
  rigidbody.velocity.y = jumpHeight;
    isFalling = true;
  }
function OnCollisionStay ()
{
isFalling = false;
}

I Get these errors:

alt text

What should I do? Thanks :slight_smile:

The error is that you did not close off your GetKeyDown(). Line 15 should be:

 if (Input.GetKeyDown(KeyCode.W) && isFalling == false ) 

Or even simplified to:

 if (Input.GetKeyDown(KeyCode.W) && !isFalling) 

Also you are missing the ‘}’ to close off Update. Insert a '} between line 19 and line 20.