Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to unbind movement keys and rebind them?

Asked by 3 years ago

I guess the title is pretty self-explanatory.

2 answers

Log in to vote
0
Answered by
Luathron 185
3 years ago
Edited 3 years ago

PlayerModule --> ControlModule --> Keyboard, line 120-129:

    ContextActionService:BindActionAtPriority("moveForwardAction", handleMoveForward, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterForward)
    ContextActionService:BindActionAtPriority("moveBackwardAction", handleMoveBackward, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterBackward)
    ContextActionService:BindActionAtPriority("moveLeftAction", handleMoveLeft, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterLeft)
    ContextActionService:BindActionAtPriority("moveRightAction", handleMoveRight, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterRight)
    ContextActionService:BindActionAtPriority("jumpAction", handleJumpAction, false,
        self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterJump)

You can adjust these to rebind some controls, for example on line 120, changing handleMoveForward to handleJumpAction, you'll jump when you press w. But I don't think it is currently possible to bind custom keys to these actions, if that's what you wanted.

Ad
Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
3 years ago
---###----------[[SERVICES]]----------###--
local ContextActionService = game:GetService("ContextActionService")



---###----------[[VARIABLES]]----------###--
local DisableMovementAction = "DisableMovement"



---###----------[[LOGIC]]----------###--
ContextActionService:BindActionAtPriority(
    DisableMovementAction,
    ---------------
    function()
        return Enum.ContextActionResult.Sink
    end
    ---------------
    false,
    Enum.ContextActionPriority.High.Value
    ---------------
    unpack(Enum.PlayerActions:GetEnumItems())
)


ContextActionService:UnbindAction(DisableMovementAction)
0
Can you elaborate on how to bind inputs to different actions, say moveBackwardAction? Feedekaiser 25 — 3y

Answer this question