Trigger Death

Hello,

how can i trigger a player death, i want the player to walk one way through the door but if he try to walk back through the door he the player will die.

Place a trigger in the door, and a trigger just outside the door. When the player touches the outside trigger the one in the door becomes primed. Then, if they touch this one, they die. Something likeā€¦

On outside Trigger -

    void OnTriggerEnter(Collider other)
    {
       if(other.gameObject.tag == "Player")
       {
           doorTrigger.GetComponent<script>.readyToKill = true;
        }
    }

On door Trigger -

public bool readyToKill = false;

void OnTriggerEnter(Collider other)
{
   if((other.gameObject.tag == "Player") && (readyToKill = true))
   {
       Destroy(other.gameObject);
   }
}

I think having the two triggers is the most bug-free way to do it. Originally I was going to suggest having just the one in the door, which becomes primed on first contact and kills on second. However, this might cause problems if they only half-entered the door and then backed out of it rather than going completely through.