Sorry for bumping, but I found a solution. Don’t know why it fires when the game starts though.
local CAS = game:GetService('ContextActionService')
function onJump(_, state)
if state == Enum.UserInputState.End then return end
print('jumped!')
end
CAS:BindAction('OnJump', onJump, false, Enum.PlayerActions.CharacterJump)
Doesnt seem to work for mobile which is my issue (achieved what I wanted by detecting when they click on the jump button), shame they still haven’t fixed it though
Oh ok, I actually forgot to test if it worked on mobile or not before I posted that. I guess the only way I know is to create a button that is only visible on mobile and toggle their fly whenever they click it. But yes, I do agree that they should make it only fire once.
Very happy to see this is being looked at. This bug is the cause for some strange behavior in my game and without a reliable way to get a jump request across every platform makes it annoying to fix. Looking forward to an update on this thread.
I’m hoping for this to change too, my game requires a double tab of the jump button to start wall climbing and it has been a struggle because of this issue.
It’s still an issue, every time I jump a single time it fires 3 times, consistent behavior which is really weird and saddening since I’m trying to make certain things happen on jump request after jumping, but they fire instantly due to the 2nd and third call, rather than when I press jump again after the initial jump
Thanks to everyone who has come here and raised awareness about this. After some internal deliberation, we’ve decided that the JumpRequest signal behaves as designed and as described in the documentation. JumpRequest fires constantly when the jump button is held down, because the player is constantly requesting a jump during this action. Consider the case in which a character is temporarily unable to jump because they are trapped under a floating platform, for example. If they hold the jump button down while the platform is above them, we still want them to jump once they are able to.
The frustration around this feature is understandable, though, as it is a bit counterintuitive at first glance. Thus, the following script creates a “jumpRequestDebouncedEvent” which will operate in the manner that folks in this thread are requesting. You may wish to adjust MAX_DEBOUNCE_FRAMES, but 8 seems to work pretty well for me.
local UserInput = game:GetService('UserInputService')
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
local jumpRequestThisFrame = false
local jumpRequestDebounced = false
local droppedFrames = 0
local MAX_DEBOUNCE_FRAMES = 8
local jumpRequestDebouncedEvent = Instance.new("BindableEvent")
jumpRequestDebouncedEvent.Name = "JumpRequestDebounced"
jumpRequestDebouncedEvent.Parent = PlayerScripts
jumpRequestDebouncedEvent.Event:Connect(function()
print("debounced JumpRequest")
end)
UserInput.JumpRequest:Connect(function()
jumpRequestThisFrame = true
end)
RunService.PostSimulation:Connect(function()
if jumpRequestThisFrame and not jumpRequestDebounced then
jumpRequestDebouncedEvent:Fire()
jumpRequestDebounced = true
elseif not jumpRequestThisFrame and jumpRequestDebounced then
droppedFrames += 1
if droppedFrames >= MAX_DEBOUNCE_FRAMES then
jumpRequestDebounced = false
droppedFrames = 0
end
end
jumpRequestThisFrame = false
end)
A while ago, I made a tool to handle jump inputs using a method that doesn’t use a debounce and isn’t affected by state changes. Since the behavior of JumpRequest isn’t going to be changed, if anyone wants a better method you should check it out:
It doesn’t make any sense, at least add separate way to handle “one jump request” to the api. Some of us design game to handle future engine updates without worrying about code stopping working out of nowhere because some engineer decides “look! let’s user handle debounce themselves, why should we care”. Isn’t Roblox about cross-platform accessibility? This is basic feature to handle stuff like double jump.
Hello, this only works in studio, on live servers it still spams the event when jump button is held.
I have no ways to properly add features requiring double jump on both pc and mobile without implementing a hack like directly checking for input.
I know it’s frustrating, I’m right there with you! But understand that I can’t just change anything I want to - in a large operation such as this, there are many factors at play - there are some fixes which cannot be done because they are disruptive to existing games, or for other, even more obscure reasons.