How Detect a Jump when in PlatformStand?

Is there any way to detect when the player jumps, while in Platform Stand? I have been currently putting the player in a ‘sitting’ state which allows for jump detection using UserInputService then putting the player back into a sitting state. However, this messes up my own jump physics as it mixes the normal jump physics with it, and it also sometimes messes up my animations when the humanoid is going back into a sitting position after jumping out of a sit. PlatformStand would work better, because it would be a constant state, the only thing is, I don’t know how to detect a jump, in a cross platform way, like the UserInputService.JumpRequest:connect does.

Any help is much appreciated.

Edit : game.ContextActionService:BindAction(“Jump”… Does work space bar on PC with platform stand, just not on mobile (at least in the emulator), and game:GetService(“UserInputService”).JumpRequest… Does not fire when in platform stand (in emulator).

The humanoid can fire the StateChanged event, which passes the humanoid’s previous state and new state to listening functions. You can try checking if there was a transition from the PlatformStanding state to the Jumping state.

More info on states: Documentation - Roblox Creator Hub

Not sure if it will change states out of platformstand unless you hit backspace, but I will test it now and edit this comment with the results.

Oh, yeah. I misread your question.

Do you think disabling the state that has been bothering you would fix the problem entirely?

I tried the StateChanged, and it did not change to a jump state.
If I were to disable the Sit state, well that wouldn’t work as I am already trying to find a non ‘sitting’ solution. I need some state I can use to stop all physics, yet detect a jump, (without changing from that state). If I were to disable jump, well that would sort of defeat the purpose

If you’re extremely desperate, you can always change their controller/camera code by adding a line where they detect a space press or a tap on the jump button to call an external method.

In case you don’t know how:

  1. Open a place
  2. Hit play
  3. Go to StarterPlayer>StarterPlayerScripts
  4. Copy the ControlScript script
  5. Stop playing and paste the ControlScript where you found it
  6. Edit

I think the code you want to look at is located in ControlScript>MasterControl>TouchJump (I may be wrong.) Anyways, this is a hassle to figure out and edit so you should do this as a last resort.

Thanks Ninja_Deer, I was looking to avoid having to customize the ControlScript, but after trying may different possible solutions, I think it will probably be the best solution at this time (though it feels a bit hacky, would be nice to have at least one good way to detect jumps over all platforms, regardless of jumppower or current humanoid state)

If you’re going to customize the control scripts, the best place to detect jumps is in MasterControl. There’s a function that jumping and moving goes through just before reaching the player. You can detect and intercept both jumping and movement there. This will work on all platforms.

2 Likes