I need help on how to make a variable for a trigger function.

I need to know how to make a variable for a trigger, for example I want to make it where I enter a trigger and something dissapears. But I want to put the script on the thing I want to make dissapear, and put the trigger that I step in to, to be the trigger variable in the script. For example. I think it might look something like this.

var trigger;

function OnTriggerEnter()
{
  trigger = destroy.gameObject
}

I know that’s not right and it may not even help to understand what I want. But if someone can do their best to help that would be nice.

This will destroy the gameobject that has this script attached once another collider (remember, one has to have a rigidbody attached) touches it:

function OnTriggerEnter()
{
     Destroy(gameObject);
}