[Legacy] How do i make my avatar play an animation when 2 keys are pressed?

So i have a little problem were i can’t make my avatar sprint when LeftShift and W is pressed i thought you could do it like this ?

if(controller.velocity.magnitude > 0 && Input.GetKey(KeyCode.LeftShift && KeyCode.W))
{
animation.Play(“sprint”);
animation[“sprint”].wrapMode = WrapMode.Loop;
}

but i can’t make it work
BTW. it’s JavaScript. just so you know :slight_smile:

Separating them should work.
if(controller.velocity.magnitude > 0 && Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.W))

1 Like