How do I get my player to die when light shines on him?

In my game, I have lights that move back and forth and I cant figure out how to make it so that my pkayer dies and respawns when he steps into the light.

Why not raycast (Unity Script Reference)? You can start your raycast at the origin of your light, and either set its distance, or opt out if you don’t want to limit it. If the raycast has a collision with your player object, then tell it to die. The raycast is just a line, so if you want to check an area rather than just a line, you can raycast several times.

If only certain lights can kill the player, you could create a cone in Blender or other 3D editor and import it to Unity, then use this mesh to create a trigger. Add or child this trigger to the killing light prefab and add to it a kinematic rigidbody, then use OnTriggerEnter to cause damage to the player with a code like this:

var damage: float = 10; // damage per second
private var victim: Collider;

function OnTriggerEnter(other: Collider){
  if (other.tag == "Player"){ // if player entered light...
    victim = other; // he becomes the victim
  }
}

function OnTriggerExit(other: Collider){
  if (other.tag == "Player"){
    victim = null; // player exited light: no victim
  }
}

function Update(){
  if (victim){ // if there is a victim under the light...
    // apply damage proportional to the exposure time
    victim.SendMessage("ApplyDamage", damage * Time.deltaTime);
  }
}

In the player (which must be tagged as “Player”) script, create the ApplyDamage function:

var health: float = 100;

function ApplyDamage(damage: float){
  health -= damage;
  if (health <= 0){
    // player is dead
  }
}