Unbind action doesn't work correctly

I’m making an 2D game and since there is a 2D perspective, the player shouldn’t be able to move left and right. So I tried unbinding the left and right moving.

So when I hold W the player shouldn’t move forward (from the 2D perspective) right? Wrong. If you press W and any other button that makes the player walk diagonal, then the player can move forward again even if you let go of the other button and keep holding W.

I couldn’t find anyway to fix this, and that’s why I’m asking here.
Here is the script that I use for both the camera and the unbind action :

local cam = workspace.CurrentCamera

local char = script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")

local ContextActionService =game:GetService("ContextActionService")
local FowardMovement = Enum.PlayerActions.CharacterForward
local BackwardMovement = Enum.PlayerActions.CharacterBackward

local function Sink()
	return Enum.ContextActionResult.Sink
end

ContextActionService:BindAction("SinkFowardMovement", Sink,false,FowardMovement)

ContextActionService:BindAction("SinkBackwardMovement",Sink,false,BackwardMovement)

game:GetService("RunService").RenderStepped:Connect(function()

	cam.CameraType = Enum.CameraType.Scriptable

	cam.CFrame = cam.CFrame:Lerp(CFrame.new(hrp.Position + Vector3.new(0, 3, 10), hrp.Position), 0.1)
end)

I think what you’re looking for is UnbindAction with the movement’s action name, which can be found using the developer console.

No that’s not what I’m looking for. I will repeat the problem. So you cant go forward, but you can diagonal. I don’t think there is any diagonal movement action.

Even if you managed to unbind W and D mobile users will still be able to move that
Two invisinle walls is a temp solution.

1 Like

Yea but usually, in a 2D fighting game there should be only left, right, crouch and jump movement. I don’t want the character to look to the camera or look away from where he is supposed to look.