How Do I Fix This Animation Bug

I made a toggle sprint but the problem is when u toggle it, if u stop running, then run again, its stuck on the first frame which isnt supposed to happen and yes, i turned on loop animation i checked 2 times before making this post. heres the code and a video

in event
Lshift is pressed you have SprintToggle ADD 1 instead of SET TO 1

Does the issue occur if you hold down the left shift button? Or once you release it?

I suspect the latter. This is because you have 2 events that have their conditions satisfied and change the animation.

This event will action if the player is moving and the left shift has been released:


And this one will action when sprint is on:


Both events will be actioned if SprintToggle = 1 and left shift has been released. The first event sets the animation to walk, while second event will set the animation to run, which starts from the first frame because the animation has changed (from walk to run), making it appear as if it’s stuck on the first frame.


The solution is to add an extra condition to the first event (that sets the walk animation) and check that SprintToggle = 0


BTW, if it’s just an on-off toggle, I suggest using a boolean and the toggle command. It saves faffing round with the value and checking if is greater than or equal to 2.


OP is using the variable like an on/off switch; click once to turn on, click again to turn off. So increasing it by 1, combined with the previous event, is correct. Just setting it to 1 would turn on the sprint and not turn it off.

1 Like

Thxs to both of yall for trying to helping me mr men ur solution worked