How do I disable specific directions of movement?

I want to make a system where you can only move side to side. I have tried to see if there is anything that says how to do it but it’s only to fully disable movement or outdated and I need advice on how to do it.

Thank you!

Pretty soon roblox will be releasing their strafing live which will be automatically enabled for every game. Currently its in beta and isn’t enabled for roblox experiences yet.

Here’s one i found

But neither of these posts are what I asked…

Hi

I think this is what you’re looking for: Tutorial:Making a 2D Platformer | Roblox Wiki | Fandom