How to make player walk only left and right

Hello! So I making a 2D fighting game. And the problem is to make player move only left and right. How can I do this?

Unbind the moveBackwardAction and moveForwardAction bindings locally and set StarterPlayer.EnableMouseLockOption to false. Example localscript in StarterCharacterScripts

game:GetService("ContextActionService"):UnbindAction("moveBackwardAction")
game:GetService("ContextActionService"):UnbindAction("moveForwardAction")
5 Likes

Thank you very much! That worked!

This seems to have been updated to:

ContextActionService:UnbindAction("forwardMovement")
ContextActionService:UnbindAction("backwardMovement")
1 Like

I can’t reproduce this issue, it still works fine for me, have you opted-in to or modified anything?