Unbinding not working?

Hello,
I’m trying to disable the “a”, “s”, and “d” keys, but it doesn’t seem to do any thing. How can I fix this?
What I currently have:

local ContextActionService = game:GetService("ContextActionService")

ContextActionService:UnbindAction("disableBackwardAction")
ContextActionService:UnbindAction("disableRightAction")
ContextActionService:UnbindAction("disableLeftAction")

Thank you in advance

I think that the action name is “moveBackwardAction”, “moveRightAction”, and “moveLeftAction”. You should take a look at this post:

After changing it to move and checking the article the only thing I really changed was changing it to “move”, but it still doesn’t function as intended.

Sounds like you have a case of your script executing before these actions are bound. The context actions for player movement are bound developer-side. Consider picking a more appropriate moment in your gameplay to unbind these actions such as when gameplay actually begins or after a little bit.

Okay, I added a wait and it still seems to not be working. What should I do? I never done this before and have no clue on what to do.

Can you share your code as of now?

Sure it’s same thing just with a wait before it

local ContextActionService = game:GetService("ContextActionService")

wait(5)

ContextActionService:UnbindAction("moveBackwardAction")

ContextActionService:UnbindAction("moveRightAction")

ContextActionService:UnbindAction("moveLeftAction")

While testing the script, have you waited for 5 seconds before trying to move?

Yes I have and I still can move normally.

Are you receiving any errors in the output?

No I don’t and I tried prints too. Nothing.

local ContextActionService = game:GetService("ContextActionService")

require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))

ContextActionService:UnbindAction("moveBackwardAction")

ContextActionService:UnbindAction("moveRightAction")

ContextActionService:UnbindAction("moveLeftAction")

This makes sure that the keys are binded before unbinding them. By the way, is this in a LocalScript?

1 Like

Yes it is would this be a problem?

No, it should be in one. Try the code I gave above.

I’ll try as soon as I can I need to do something.

https://developer.roblox.com/en-us/api-reference/function/ContextActionService/UnbindAction

1 Like