Distrance command is not working

var obj : Transform;

function Update() {
var distance = Vector3.Distance(transform.position, obj.position);

if (distance < 10) {
Destroy(gameObject);
}
}

Use GetComponent to retrieve the transform of the object which obj is meant to represent.

http://docs.unity3d.com/Documentation/ScriptReference/GameObject.GetComponent.html