disable running on x axis

Hey, I’m making a horror game and I’d like to know if anyone can help me, I wanted to disable the character’s running speed on the y axis, making him walk and run on the x axis but on the y axis he just walks, does anyone know? how can I do this?