object reference not set to an instance of an object

var speed : float;
var turn : float;

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

  var newRotation = Quaternion.LookRotation(
    closest.transform.position - closest.position, Vector3.forward);

  transform.rotation = Quaternion.Slerp(
    transform.rotation, newRotation, Time.deltaTime * 8);

  transform.position += transform.forward*speed*Time.deltaTime;
}

Your not checking wheather or not closest exists. If it doesn’t find any objects, closest will be null, therefore the null reference exception.

Thats at least one of the problems…

Hope this helps,
Benproductions1