Animation not animationing for some reason

The problem I am having is in this part of the code:

if (Station.CompareTag("Station") && Input.GetKeyDown(KeyCode.F))
{
    myStation.SetBool("Station_Bool", true);
}

I am pretty sure what’s messing up the code is the part after &&. I checked without it and then the animation works well. But it doesn’t do the animation when I want to. Instead of doing the animation once you’re in the trigger zone AND the F key is pressed. It just does the animation immediately when I enter the trigger zone. If I add the part after && the animation just doesn’t happen.

I don’t really know what’s making it not do the animation, so if someone could help I’d appreciate the help :slight_smile:

[SerializeField] private Animator myStation;
public int power;
public GameObject Station;
public TextMeshProUGUI powerDisplay;
public GameObject collisionCheck;

void Start()
{
    Station.SetActive(false);
    collisionCheck.SetActive(false);
}

void Update()
{
    powerDisplay.text = power.ToString();

    if (Input.GetKeyDown(KeyCode.E) && power > 0)
    {
        power -= 1;
    }
    if (power == 0)
    {
        Station.SetActive(true);
    }
    if (collisionCheck.activeSelf == true && Input.GetKeyDown(KeyCode.F))
    {
        power = 3;
        collisionCheck.SetActive(false);
    }
}

void OnTriggerEnter(Collider Station)
{
    if (Station.CompareTag("Station"))
    {
        collisionCheck.SetActive(true);
    }
    if (Station.CompareTag("Station") && Input.GetKeyDown(KeyCode.F))
    {
        myStation.SetBool("Station_Bool", true);
    }
}

void OnTriggerExit(Collider Station)
{
    if (Station.CompareTag("Station"))
    {
        collisionCheck.SetActive(false);
    }
}

Input.GetKeyDown() is meant to be used in Update only and will give you unpredictable behavior elsewhere.