animation plays when button is pressed, but when I let go it won't play again

I have created a script so that my animation starts when I press ‘d’ and stops when I let go. But then it won’t start again (when I press d).

using UnityEngine;

public class animation_hero : MonoBehaviour
{
public GameObject hero;

void Update()
{
if (Input.GetKey(“d”))
{

hero.GetComponent().Play(“animation”);

}

if (Input.GetKeyUp(“d”))
{
hero.GetComponent().enabled = false;

}

}

}

Fixed it, just had to enable the animator when I press d