Odd scripting error

Why is this code not working? It should work just fine as written but it keeps giving an insert semicolon error.

var attractedTo : GameObject ;
var strengthOfAttraction : float = 5.0f;

function Update()
{
	Vector3 direction = attractedTo.transform.position - transform.position;
	rigidBody.AddForce(strengthOfAttraction * direction);
}

You are using a C# style declaration on line 6. Line 6 should be:

var direction = attractedTo.transform.position - transform.position;

…or:

var direction : Vector3 = attractedTo.transform.position - transform.position;

For future questions, please include a copy of the error message from the console. The message gives us the line number of the error and the stack trace.

Vector3 direction = attractedTo.transform.position - transform.position; is written in c# whereas the rest of your code is written in UnityScript. rewrite that to: var direction : Vector3 = attractedTo.transform.position - transform.position;