# HELP - Sprint only when pressing W

**URL:** <https://forums.unrealengine.com/t/help-sprint-only-when-pressing-w/2257037>\
**Category:** Community & Industry Discussion\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [January 3, 2025, 5:19am UTC](https://forums.unrealengine.com/t/help-sprint-only-when-pressing-w/2257037 "2025-01-03T05:19:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattOwen1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MattOwen1](https://forums.unrealengine.com/u/MattOwen1)\
**Post date:** [January 3, 2025, 5:19am UTC](https://forums.unrealengine.com/t/help-sprint-only-when-pressing-w/2257037/1 "2025-01-03T05:19:56Z")

</div>

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:

 ![Screenshot 2025-01-02 193351](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/f/bcf17f04deaca6658dbc30a482d028b1eca84b7f.png)  
 ![Screenshot 2025-01-02 193406](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/b/73b0d3d2542151facbeefd6a7d54d4b76f2f84fd.png)

---

<div class="post-metadata">

**Author:** ![MattOwen1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MattOwen1](https://forums.unrealengine.com/u/MattOwen1)\
**Post date:** [January 4, 2025, 3:49am UTC](https://forums.unrealengine.com/t/help-sprint-only-when-pressing-w/2257037/2 "2025-01-04T03:49:59Z")

</div>

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:

 ![Screenshot 2025-01-02 1931](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/9/e/89ec3f6d21ffdfc3c068e40e13cba7ec774736af.png)

---

<div class="post-metadata">

**Author:** ![MattOwen1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MattOwen1](https://forums.unrealengine.com/u/MattOwen1)\
**Post date:** [January 4, 2025, 4:16am UTC](https://forums.unrealengine.com/t/help-sprint-only-when-pressing-w/2257037/3 "2025-01-04T04:16:34Z")

</div>

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:

 ![Screenshot 2025-01-03 231533](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/b/2cba922088b5205b21629e381675f656858b2ea1.png)

---

<div class="post-metadata">

**Author:** ![MattOwen1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MattOwen1](https://forums.unrealengine.com/u/MattOwen1)\
**Post date:** [January 4, 2025, 4:24am UTC](https://forums.unrealengine.com/t/help-sprint-only-when-pressing-w/2257037/4 "2025-01-04T04:24:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 3, 2025, 4:24am UTC](https://forums.unrealengine.com/t/help-sprint-only-when-pressing-w/2257037/5 "2025-02-03T04:24:59Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
