Script only working in editor

A script that I copied from a tutorial only works when it is being run inside the editor. When I export it nothing happens. (the script is for moving platforms)

Here is the script:

var targetA : GameObject; var targetB : GameObject;

var speed : float = 0.1;

function Update () { var weight = Mathf.Cos(Time.time * speed * 2 * Mathf.PI) * 0.5 + 0.5; transform.position = targetA.transform.position * weight + targetB.transform.position * (1-weight); }

What is going wrong?

while I can't see anything wrong with the script, it is probably a good idea to check the player log files to see if there are any error messages. See the docs for the location of the player log (when running in a web player).