Finding Distances With Vector3

I'm trying to create a script, so that when the object 'runner' is 500m away, a rigidbody will be added. I've looked through the scipting manual, yet that produces an error, which I cannot solve. Where am I going wrong?

var runner : transform;
var closeDistance : float = 500;
    function Update (){
    if (runner) {
    var dist = Vector3.Distance(runner.position, transform.position);
    if (dist < closeDistance);
    if(!dist.gameObject.rigidbody){
       dist.gameObject.AddComponent(Rigidbody);
      }

    }
    }

Thanks.

I'm assuming you really want to be adding the Rigidbody to the runner object. You're attempting to add it to dist, which is a float value; epic fail.

You probably want something like this:

function Update (){
    if(runner){
        var dist = Vector3.Distance(runner.position, transform.position);
        if(dist < closeDistance && !runner.gameObject.rigidbody){
           runner.gameObject.AddComponent(Rigidbody);
        }
    }
}