what is the problem ??

var explosion : Transform;

function Update(){
    var targets = GameObject.FindGameObjectwithTag("target");
    var cloest : GameObject;
    var closestDist = Mathf.Infinity;


    for (Target in targets) {
        var dist = (transform.position - Target.transform.position).sqrMagnitude;
        if (dist < closestDist) {
            closestDist = dist;
            closest = Target;
        }
    }


    transform.LookAt(Target);

    transform.position = Vector3.Lerp(transform.position, Target.position, Time.time*0.5);

    if (transform.position==Target.position){
        Instantiate (explosion, Target.position, transform.rotation);
        Destroy(gameObject);
    }
}

You haven’t actually said what your problem is, but you’re trying to reference Target outside of your for loop. Try this:

var explosion : Transform;
 
function Update(){
    var targets = GameObject.FindGameObjectwithTag("target");
    var cloest : GameObject;
    var closestDist = Mathf.Infinity;
 
 
    for (Target in targets) {
        var dist = (transform.position - Target.transform.position).sqrMagnitude;
        if (dist < closestDist) {
            closestDist = dist;
            closest = Target;
        }

 
 
        transform.LookAt(Target);
 
        transform.position = Vector3.Lerp(transform.position, Target.position, Time.time*0.5);
 
        if (transform.position==Target.position){
            Instantiate (explosion, Target.position, transform.rotation);
            Destroy(gameObject);
        }
    }
}