Using ButtonA and overriding jump on Xbox

So I’m working on the finishing touches to my games port to XBox.

I’ve bound ButtonA to advance a UI element at the end of a round, but ButtonA also makes the character jump. The bound function doesn’t fire either and so the player just ends up jumping around, unable to select the ‘advance’ button.

Is there an easy way to override jumping temporarily to allow CAS to work properly? (I could detect a jump and then stop it, but I don’t think that would fire my bound function)

1 Like

How exactly are you binding the advance button? ContextActionService bound actions work like a stack, so if you put something on top of the stack that is the function that should be called for that keycode.

ContextActionService:BindAction(“Advance”,advanceFunction, false, Enum.KeyCode.ButtonA)

This should mean that your advance function is called instead of the jump function. When you unbind that action, ContextActionService will fire the jump function again.

Yeah thats what I thought should happen, turns out that this bug was with a UI that shows at the start of the game, (not the end of the round - I just tested that and it does work).

I did some checking, and it seems as though ControlScript loads into the player after PlayerGui elements do, and therefore jump was actually bound over the top of my advance button.

I just added a WaitForChild(“ControlScript”) and the problem was solved.