How to play an animation on button press only in trigger stay?

Consider a gun present on a table. If I go near the gun a message box must be displayed which informs the user to press ‘F’ to select the gun. Only when this message box is displayed must the animation for the gun selection be played on hitting the ‘F’ key.

Could some one help me out with the code for this?

for c#

void OnTriggerStay(Collider col){
        //Animation and method here...