Jump Button input won't register on gamepad controller

I have tried to debug this for a long time and can’t figure out a good way to fix this, whenever I try to use the controller the jump button won’t function, I’m aware that this has something to do with the default player controller (forcefully) getting the jump input as it’s top priority. Pretty much all other buttons on the controller works but the jump button.

This doesn’t seem to be an issue when I use the keyboard.


uis.InputBegan:Connect(function(input)
	
	if input == Enum.KeyCode.ButtonA then
	
		ToggleFlying()
		print("sghgywehuywe")
	
	end
	
end)

I have also tried just setting the priority to a high number with ContextActionService but this depends on luck if it works or not.

ContextActionService:BindAction("Jump", handleAction, false, Enum.KeyCode.Space, Enum.KeyCode.ButtonA)

ContextActionService:BindActionAtPriority("Jump", handleAction, false, 100000, Enum.KeyCode.Space, Enum.KeyCode.ButtonA)

input is referring to the InputObject, but in order to check if the player pressed that specific key / button, it’d need to be comparing the value of the InputObject.KeyCode property with it:

if input.KeyCode == Enum.KeyCode.ButtonA then
2 Likes

Looking back at this, while this did fix the if statement above this will only register after the player has jumped before hand and not while the player is jumping.

humanoid.Jumping exists but it runs multiple times and isn’t very practical.

1 Like

Ah, so to clarify, are you wanting to:

  • Completely override the jump with custom behavior (preventing the player from jumping at all and just activating the “ToggleFlying” function)

  • Or do you want to check if a player presses the jump key only while they are in mid-air, and if so, activate the “ToggleFlying” function

  • Or something else?

I may know a potential solution but I don’t know for sure if I interpreted your question correctly, so I want to make sure I fully understand what you want to achieve, first

1 Like

The first one, I am making my own jumping system which has double jumping, everything is in place it’s just the jump detection is driving me up the wall.

1 Like

Oh, in that case, as long as you aren’t relying on this for the custom functionality, you can completely disable the built-in Jumping state through Humanoid:SetStateEnabled(), which would prevent the Character from ever entering the Jumping HumanoidStateType.

Example

-- Disables the Character's ability to jump
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
1 Like

Just testing this out on my laptop, this seems to work, I will set this as the solution for now. I will update you if I encounter any problems relating to this very topic. Thanks for helping!

1 Like

So it turns out this code disables the Jump Button on mobile, so this isn’t a very practical solution.

1 Like

As a hacky work around I simply just decided to make my own jumpbutton inplace of the Default one.

local JumpButton = ContextActionService:GetButton("Jump")
if JumpButton then
	JumpButton.Image = "rbxassetid://1234"
	JumpButton.Position = UDim2.new(1,-170, 1, -210)
	JumpButton.Size = UDim2.new(0,120,0,120)
	JumpButton.PressedImage = "rbxassetid://1234"
	
	JumpButton.MouseButton1Up:Connect(function()

		wait()
		JumpButton.Image = "rbxassetid://1234"

	end)
end


if uis.TouchEnabled then
	
	player:WaitForChild("PlayerGui"):WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("JumpButton"):Destroy()
	
end
1 Like

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