HELP - Sprint only when pressing W

So I’m trying to make it so that a player can only sprint when they are holding the W key. My current blueprint KINDA works. Problem is, if the player starts sprinting while pressing W and Shift and then changes direction (pressed A, S or D) then can still sprint. I understand that I need to run some kind of loop that checks whether or not W is still pressed, I just don’t know how to go about implementing that in blueprints.

Current blueprint:


I made some changes to check if a player can sprint. It works fine, BUT. If the player starts sprinting and then changes direction while still holding shift they can still sprint sideways. Can’t figure out how to prevent that. I imagine I need some kind of loop to check the direction?

Updated blueprint:

Okay, kinda embarrassing but all I had to do was disconnect the “completed” exec from the input and use the “triggered” exec only, solved blueprint:

Don’t actually have to disconnect the “completed” exec, just need to use “triggered” instead of “started”