Animation not playing! Help needed!

Hi, so I am new to Unity and I have created an animation to play when my character gets damaged that makes them flash red. I called this anim “Player_Damaged” and applied to to the animation component on my player. I have set it to legacy and vice versa but neither work. Legacy mode comes up with no errors however, and this randomly started happening as it was working fine before. I have remade the animation 20+ times and have tried all sorts of things! Please help me out. Here is some code:

public void  Damage(int dmg){

	currentHP -= dmg; 

	gameObject.GetComponent<Animation>().Play("Player_Damaged");

You make red flash anim. I think you use Image component for flash red anim. But you add Animation component to your Player. You should add the animation component to the red flash object.

public class PlayerScript : MonoBehaviour
{
     //drag red flash object to the instance below
     public GameObject redFlashObject;
     public int currentHP;

     public void Damage(int dmg)
     {
          currentHP -= dmg;
          redFlashObject.GetComponent<Animation>().Play("Player_Damaged");
     }

}