Animation wont work?

if (Input.GetKeyDown (KeyCode.LeftShift)) {
anim.Play (“CrossbowZoom”, -1, 0f);

			if (Input.GetKey (KeyCode.LeftShift)) {
				anim.Play ("CrossbowIdle2", -1, 0f);

			}

		}

So basically I want “CrossbowZoom” to play if I press left shift, and then, if I continue holding it, I wan’t it to start playing “CrossbowIdle2.” It just skips right over “CrossbowZoom.” Any help?

if (Input.GetKeyDown (KeyCode.LeftShift)) {
anim.Play (“CrossbowZoom”, -1, 0f);

             if (Input.GetKeyDown (KeyCode.LeftShift)) {
                 anim.Play ("CrossbowIdle2", -1, 0f);
 
             }
 
         }

Im not quite sure what is intended but I guess “CrossbowZoom” is a one time animation and “CrossbowIdle2” just follows it and then keeps going when keeping holding shift?

In that case i would try following:

    if (Input.GetKeyDown (KeyCode.LeftShift)) {
       anim.Play ("CrossbowZoom", -1, 0f);
    }
    
    if (Input.GetKey (KeyCode.LeftShift) && anim.GetCurrentAnimatorStateInfo(0).IsName("CrossbowZoom") &&
anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 > 0.9f) {
         anim.Play ("CrossbowIdle2", -1);
     }

Just a suggestion since I always use the animator window to do the transitions and control them in the script via parameters.