A jump input event that fires once

I’m having a really hard time trying to figure out when the player tries to jump.

My first instinct is to listen for changes to Humanoid.Jump, but unfortunately this property seems to change 6 times every time you jump.

This means I need to look for another way. For PC I can just listen for the spacebar, but for cross-platform I have to search for a convenient interface. The first one I find is the Enum.PlayerActions.CharacterJump input for ContextActionService, but apparently this is wrong and doesn’t work on every platform, or it used to and it got replaced for some reason.

The next thing I find is UserInputService.JumpRequest, and I’m back to the same problem as before; it fires 3 times every time I jump. The wiki recommends a debounce but it doesn’t recommend a certain length, and I would prefer when a player wants to do a double jump that it is perfectly responsive.

I think figuring out when the player inputs a jump action shouldn’t be this hard.

5 Likes

Have you tried listening to Humanoid.Jumping? The wiki doesn’t indicate that it should fire rapidly, but that may be an oversight.

1 Like

Can’t you just use a debounce?

Things like Humanoid.Jumping and Humanoid.StateChanged don’t work if the player has no character with a humanoid, or the character isn’t on the ground, or the jumping state is disabled. I want to listen for the actual input to jump.

There is no acceptable standard length to wait and I would prefer that the inputs are perfectly responsive and aren’t ignored for being too fast just because fake input events are being spammed over the real ones.

1 Like