I wrote a javascript to control a hinge joint motor, What's wrong? It says All compiler errors have to be fixed?

#pragma strict

function Start () {
// Disable the motor on the HingeJoint component.
var hinge : HingeJoint2D;
hinge = GetComponent(HingeJoint2D);
hinge.useMotor = false;

}

function Update () {
var throttle = Input.GetKey(KeyCode.UpArrow);

if(throttle == true) {
hinge.useMotor = true;
}
else {
hinge.useMotor = false;
}
}

Hi

you should use transform.GetComponent() and please do post the error .They will be shown on the bottom of the screen

Try making this code

function Start () { 
// Disable the motor on the HingeJoint component. var hinge : HingeJoint2D; 
hinge = transform.GetComponent(HingeJoint2D);
 hinge.useMotor = false;

}
function Update () { 


if(Input.GetKey(KeyCode.UpArrow)) 
{ hinge.useMotor = true; } else
 { hinge.useMotor = false; } }