How do I restrict my character's movement to one axis?

Not enough information.

Are you using the default BP_ThirdPersonCharacter?