Expected Behavior
What I expect to happen is that it should print “oops!” when pressing the Jump button.
Actual Behavior
What actually happens is that it does not print “oops!” when pressing the Jump button.
Workaround
My workaround is to use the InputBegan event on the JumpButton instance in the player’s PlayerGui to detect mobile jumps.
Issue Area: Engine Issue Type: Other Impact: Moderate Frequency: Very Rarely Date First Experienced: 2021-07-02 22:07:00 (-05:00) Date Last Experienced: 2021-07-02 22:07:00 (-05:00)
You are right! That clears up a lot of confusion. However, it remains to be said that the action is not triggered with any state at all when pressing the jump button itself.
for i = 1, 11 do
game:GetService("ContextActionService"):BindActionAtPriority(
"reproduceBugAction" .. i,
function(name, state)
print("oops!", state)
end,
false,
10^(i-1),
Enum.PlayerActions.CharacterJump
)
end
None of these priorities (1, 10, 100, …, 10^10) seem to work.
Have you first tried it on desktop? IIRC, 2100 should be okay.
Dealing with mobile might require you to look into things such as PlayerModule's GetControls():GetActiveController(), etc. Might want to take it over to
CharacterJump does not register for Consoles either:
It’d be helpful to have a universal set of events/signals/contexts which can be used to listen for actions such as jumping, instead of solely limiting these to keyboard, as it makes accounting for multiple device types infinitely more challenging.
What they have said is accurate, we have however a workaround that is probably not good but it works, put an invisible button over the jump pad for mobile, and use that as the jump action.
ContextActionService has a noble design goal, but it is not fully implemented. You can see how I did workaround for mobile jump and mobile thumbstick in the Flight Thread. See also my Flight Sample which is unlocked. Here’s the relevant code from there:
-- CAS doesn't fire Enum.PlayerActions.CharacterJump on mobile
UIS.JumpRequest:Connect(function()
if (not humanoid or humanoid:GetState() == Enum.HumanoidStateType.Dead) then
return;
end
setFlying(not isFlying)
-- print('jumped, movement=', movement)
end)
The part where it calls setFlying() is a toggle to turn on and off the flight features, that’s where you would put your own handler for the jump button.