OnTriggerStay Instantiate Problem (just want a single spawn, but there are multiple)

Hello People, im trying to spawn a collectable gameobjet every time my Character Stays within a Trigger and presses a button.

e.g. Move Player in front of an automat, press "E" and spawn a collectable ticket besides the automat. Thats the EXACT way i want it to be happen.

i got it completly working so far with this script:

var object: GameObject;
var object2: GameObject;

function OnTriggerStay(Player : Collider) {
    if (Input.GetButtonUp("Action")){
        Instantiate (object, Vector3(11,1,16), transform.rotation);
        Debug.Log("You can pick up your ticket right next to the vendor.");
    }
    else
    {
        if (Input.GetKeyUp("r")){
            Instantiate (object2, Vector3(13.4,1,16), transform.rotation);
            Debug.Log("You can pick up your ticket right next to the vendor.");
        }
    }
}

BUT every time i Press the "E" button to instantiate the ticket it instantiates MULTIPLE tickets. i just want a single one tho. Could anyone help me out with this pls ?

thx in advance :)

Using OnTriggerStay is something I try to avoid as much as possible. Try setting a boolean according to whether your character is close or not to the machine. Something like this:

   var object: GameObject;
   var object2: GameObject;
   var isNearby:boolean;

function Update(){
    if(Input.GetButtonUp("Action") && isNearby){
        Instantiate (object, Vector3(11,1,16), transform.rotation);
        Debug.Log("You can pick up your ticket right next to the vendor.");
    }else{
        if(Input.GetKeyUp("r") && isNearby){
            Instantiate (object2, Vector3(13.4,1,16), transform.rotation);
            Debug.Log("You can pick up your ticket right next to the vendor.");
        }
    }
}

function OnTriggerEnter(Player : Collider) {
    isNearby = true;
}

function OnTriggerExit(Player : Collider) {
    isNearby = false;
}