HELP - Trying to stop my character from sprinting left, right and backwards

So I’m doing an early development of a third person shooter and i have a walking state and a sprinting state, thats mostly sorted although i only want the character to sprint forwards not sideways or backwards. I’ve looked all over the internet and UE posts on reddit and forums for a solution but none of them work.
For context my camera moves to wherever my character is facing.

try to use those node in your character blueprint

Thanks for responding, I’m going to try this out today, I’ll respond later if it works for me or not

So I’ve copied the code exactly although I’m a bit confused it just boosts my character in the forward facing direction. Sorry I am really new to UE5. What I want is W+Left Shift to sprint again in the forward facing direction, and when I use Left Shift + A/S/D to ignore the Left Shift input and to stay in my walking state.

Hello if anyone else can still see this I really need help, if there are any existing threads can someone link me to them! Or give me a solution I’ve been struggling with this for a week

Your ‘sprinting’ meaning high speed or flash?

high speed use this node

屏幕截图 2022-05-03 194352

flash use

屏幕截图 2022-05-03 194434

and this

ignore the Left Shift input.

By the way, the default walk speed is 600.