On Mobile, Enum.PlayerActions.CharacterJump does not correctly bind to jump button press

Reproduction Steps

  1. Open a Baseplate in Studio
  2. Insert a LocalScript into StarterPlayer.StarterPlayerScripts
  3. Paste the following code:
game:GetService("ContextActionService"):BindAction(
	"reproduceBugAction",
	function()
		print("oops!")
	end,
	false,
	Enum.PlayerActions.CharacterJump
)
  1. Set emulation mode to mobile (or publish place and test via Roblox mobile app on a phone)
  2. Observe that pressing the Jump button does not cause “oops!” to be printed.

System Information:

  • OS: Windows 10
  • CPU: AMD Ryzen 9 4900HS with Radeon Graphics @ 3.00 GHz
  • Memory: 16 GB
  • GPU: NVIDIA GeForce RTX 2060 with Max-Q Design

And, if it’s relevant, this also reproduces when testing on the Roblox app via my iPhone 12.

Repro file: BugRepro.rbxl (28.3 KB)

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)

5 Likes

Please check your input state and see if it’s Enum.UserInputState.Cancel–I’d be very surprised
if this is not what you are seeing, which is not a bug.

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.

I’ve edited the original post accordingly.

Did you try using BindActionAtPriority() with a higher-than-default priority?

Just tried doing this:

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

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

3 Likes

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.

2 Likes

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.

There are other ways to get notified of jump events, so the priority of this bug is not that high as you make it seem with your wording.

The Impact/Frequency listed on the first post is appropriate.

This is still an issue and is affecting my development. Would love an update to see if this could be fixed soon!

2 Likes

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.