Adding a debounce to your code should serve as a simple fix, not sure why there’s complaining about this. (assuming the debounce works)
Debounce doesn’t solve my problem.
I have to resort to something like this to wait the request spam out
The API says it’ll fire multiple times, maybe it not firing was a bug?
Since this event fires multiple times for a single jump request, using a debounce is suggested.
I really hope Roblox changes this behavior; it would make life much easier. In the mean time, here is a script that detects if the player jumped:
local function Jumped()
if jumpDebounce == true then return end
jumpDebounce = true
print("Jumped")
wait()
jumpDebounce = false
end
Humanoid.Jumping:Connect(Jumped)
Bumping this because we didn’t get any response from Roblox yet. Why is this still not fixed and did anyone find any workarounds?
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)
From this reply:
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.
Sorry for the late bump, is the original issue still occurring here? We think everything is working fine.
It in fact does still fire multiple times on a single tap
I can confirm that I still get this issue. It’s proven to be quite a pain to deal with.
Just pinged the engineers, hang tight!
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.
3 months later, and this is still an issue.
Looks like the engineers are discussing it!
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.