How to prevent movement for certain keys?

How would I disable a certain key for movement of the character? Like if I am making a “2d” platformer game, I would only want it moving on the X and Y axis.

Edit

I have also tried using ContextActionService but that failed for me (because i’m not great at scripting lol) Maybe I did something wrong?
poorly made picture

I believe this video would help you out:

It goes over how to make the controls only go left and right, not forwards and backwards.

1 Like

Thanks! I have seen the video a while ago, and I pretty much forgot about it. (Thats what worked the other time)

1 Like