Bug where I can sprint while crouching

Hey there!

I’m a new game developer using Unreal Engine 5, and I’m working on some basic mechanics like sprinting and crouching using Blueprint. I’ve hit a bit of a snag and I was hoping someone could help me out.

Basically, my player can sprint while crouching, but I don’t want that to be possible. I just want the player to move at a normal crouching speed, even if they’re holding down the sprint button. I’ve included some screenshots of the code I’ve written for the sprint and crouch mechanics.

If anyone has any ideas or advice on how to fix this, I’d really appreciate it! Thanks in advance for your help.




The easiest way to fix this would require another bool for whether you’re crouching or not.

The sprinting can be made like so:


Although in this case Stop Sprinting could be called even when you never started sprinting, that shouldn’t be a problem.

You can do the same for crouching substituting the crouching bool for the sprinting one