Input.GetKey not working for animations or bools

Hey, I’m trying to make a door animation for my game, where a text will appear telling you to use the F key to interact, and if you press it, an animation will play and the bool that controls if the door is open or not, would change. Even though the text is showing when I enter the trigger, the door animation and boolean don’t work when the F key is pressed. Also, I’ve noticed that when I press F, sometimes it’s almost like the door collider animates, but the mesh doesn’t. Here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class Interact : MonoBehaviour
{
    public TextMeshProUGUI IASText;
    public Animation SelectedAnimation;
    public bool IsOpen;
    public bool InTrigger = false;

    private void Start()
    {
        IsOpen = false;
        InTrigger = false;
    }
    private void Update()
    {
        if (InTrigger)
        {
            IASText.text = "Press F to interact";

            if (Input.GetKeyDown(KeyCode.F) && !IsOpen)
            {
                SelectedAnimation.Play("OpenDoor");
                IsOpen = true;
            }

            if (Input.GetKeyDown(KeyCode.F) && IsOpen)
            {
                SelectedAnimation.Play("CloseDoor");
                IsOpen = false;
            }
        }
        if (!InTrigger)
        {
            IASText.text = "";
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        InTrigger = true;
    }
    private void OnTriggerStay(Collider other)
    {
        InTrigger = true;
    }
    private void OnTriggerExit(Collider other)
    {
        InTrigger = false;
    }
}

I found the answer, the game object was marked as static :confused: