need your help

Hello, I have two questions. The first is that function is best to start the animation when you press shift.
And the second is how do I write a script to shift? if (fill in here input.o what?)
My script looks like this:

function Update () {
     if (Input.GetButton ("shift"));
           animation.Play ("KnifeFire");
}

Either set up the Shift key as a Input Button in the project / Input settings, or use …

Input.GetKey(KeyCode.LeftShift) or w/e key you want.

Also, i am not sure if theres another way to stop this annoyance, but i find that if you dont use a bool state to trap when its playing , it may keep trying to restart instantly over and over with that script you have there. For eg:

if(Input.GetKey(KeyCode.LeftShift)){
  if(!animation.isPlaying){
     animation.Play("whatever");
  }
}

Thank’s

Now I need to give it that when I hold the shift key and start the animation Sprint. And when I go down the shift key that starts the animation Sprint2. Will you help me with this? Please.

try used Input.GetKeyDown

so does that mean?

function Update () {
if (Input.GetKey (KeyCode.LeftShift)) {
   if (! animation.isPlaying) {
      animation.Play ("Sprint");
   }
}
if (Input.GetKeyDown (KeyCode.LeftShift)) {
if (! animation.isPlaying) {
animation.Play ("Sprint2");
}
}
}

Please anyone help me

please i need this