Sprint Functionality

I am trying to create a battle royale game. In it I have added all the essential animations for movement but I don’t like how we have to keep holding shift to sprint. So I managed to make a functionality in which if we press shift once our player will start to sprint and stop only if we press shift again. After that I wanted the player to sprint in the forward direction without me pressing the ‘W’ key when in sprint mode. I found a short tutorial for it and found it was very easy. But It only worked when i did it with event begin and not with shift key can you please tell me if i have done anything wrong?

Here is the image of my blueprint forgot to attach it

You should use the default method for movement input instead of what you currently have mocked up (its what comes setup when you first make the template project).
Then, for your sprint input, you want to set max walk speed based on pressed and released.
For pressed, max walk speed is sprint speed.
When released, max walk speed is normal speed.

Create a variable “canSprint” (Boolean) and make it true when shift is pressed and false when shift is released.
Then from event tick take a branch with the condition canSprint And continue with your code