Hi, I’d like to remove the forward and backward movement on keyboard (meaning removing the use of ‘w’ & ‘s’ key to move). I’ve tried searching on YouTube but I couldn’t find anything about it.
You can access the player scripts and disable the w and s contextactionservice bind from there.
A hacky way of doing this would be using ContextActionService and assigning an empty function to both of those keys. However: this only overrides the core scripts, and can easily be bypassed.
A better way of doing this would be by forking the scripts that are loaded in (usually in player.PlayerScripts).
Copy the player scripts from the player instance like I do:
Paste them into StarterPlayerScripts:
Control modules > Keyboard module script
Go into lines 88-94 and delete the body of the move forwards and backwards functions:
You now have a left-right control system for your game.
You can remove the bindings of the keys. Much simpler solution.
local ContextActionService = game:GetService("ContextActionService")
ContextActionService:UnbindAction("moveForwardAction")
ContextActionService:UnbindAction("moveBackwardAction")
I don’t recommend forking systems unless you need to make major technical changes to them or if your use case is not natively supported by the engine.
Roblox has updated a bit so i will tell you how to do it in the updated version.
play the game then copy a script called “ControlScript” StarterPlayer>StarterPlayerScripts>ControlScript
then stop the game and paste under StarterPlayerScripts
next open the script to “KeyboardMovement” StarterPlayer>StarterPlayerScripts>ControlScript>MasterControl>KeyboardMovement
go to line 110-118, delete what ever key you want to remove