Why does my running animation not work?

Hi everyone! So first, this is my code for the animations:

if (Input.GetAxis("Horizontal") != 0 & Input.GetAxis("Fire3")!=0)
    {
        GetComponent<Animation>().Stop("walk");
        GetComponent<Animation>().Play("run");
   }

    if (Input.GetAxis("Vertical") != 0 & Input.GetAxis("Fire3") !=0)
    {
        GetComponent<Animation>().Stop("walk");
        GetComponent<Animation>().Play("run");
      
    }

    if (Input.GetAxis("Horizontal") != 0)
    {
        GetComponent<Animation>().Play("walk");
    }

    if (Input.GetAxis("Vertical") != 0)
    {
        GetComponent<Animation>().Play("walk");
      
    }

When I press “w” , my character walk but at the moment I press left shift at the same time the animation freeze and my character does not move for a reason that I don’t know. I wish for someone who will help me for my problem! Thank you! :slight_smile:

Why don´t you use an animator controller? they´re pretty easy to use

public Animator animator;

Hor = Input.GetAxis("Horizontal");
animator.setFloat("Horizontal", Hor);

Ver = Input.GetAxis("Vertical");
animator.setFloat("Vertical", Ver);

the you just put 2 floats parameters and then the transition.