Player movement corescripts should not sink input to default keys/buttons

Currently, as of 2/21/24, the player movement corescripts sink input to default-binded keys instead of passing input, making it impossible for me to bind my own actions on top of them.

To reproduce:

  1. Bind an action to the “A” button on an xbox controller, via ContextActionService:BindAction()
  2. Notice that your binded action is sometimes not ran, because the player movement module sinks input to it (Gamepad.lua, line 96)

InputSink_Repro.rbxl (146.7 KB)

I’d filed a bug report about this in early 2021, but it was never actioned on. Because of the new ticket system I am re-filing:

Expected behavior

I expect the corescripts to not sink input to any buttons. There are cases where I as a developer want to bind actions on top of a default-binded button, e.g. I bind an action to the “A” button on xbox even though it’s already default-binded to being a jump button.

1 Like

Thanks for the report! We’ll follow up when we have an update for you.

1 Like

Hello, the intended way for you to bind an action on top of the default is to bind the action at a higher priority. Thanks for providing a repro place file! You can modify it by changing to this:

ContextActionService:BindActionAtPriority("WallJump_Action",HandleInput,false,Enum.ContextActionPriority.High.Value,Enum.KeyCode.Space,Enum.KeyCode.ButtonA)

It’s also possible to pass Enum.ContextActionResult.Sink back from your function if you want the default jump action to not execute. That may be useful if, for example, if you decide to trigger your wall jump.

We will consider this to be working as expected. Thanks!

1 Like

The problem with this is, passing sink is not guaranteed to work if the corescript’s binded action is executed first by contextactionservice, because that itself passes Sink.

Is this guaranteed behavior that will never change? The contextaction priority that the corescripts use should be documented in the creator docs if so.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.