How to make clip animation run when walking?

I am trying to play an animation while the player is holding down a key, and return to frame one when he isn’t. How would I do this? Thanks!

Try something like this in the update script:

// Replace KEY with the name of the key
// Replace ClipName with the name of the clip
if(isKeyDown(“KEY”)){
ClipName.play();
}else{
ClipName.gotoAndStop(1);
}
2 Likes