How can I prevent a character from turning when in the air

It works, but I’d prefer a solution where the player still has control over the character’s movement (without using momentum).