this depends how you are controlling your player pawn/character
The usual setup is to use a Blend Space to manage your inputs (mouse and keyboard). There are a bunch of tutorials on YouTube for this… here’s an official Epic one from their channel BP 3rd Person Game: Blend Spaces | 07 | v4.8 Tutorial Series | Unreal Engine - YouTube