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;