The title is pretty much self explanatory. This is for my bunnyhop system, the purpose is to check if the player jumped right after the previous jump, if not their bunnyhop velocity would be taken away.
Late at night, so my response won’t be spectacular, BUT you can do some physics calculations to determine it
v = u + at
is a formula from physics, where v is the final velocity, u is the initial velocity, a is acceleration, and t is time.
Rearranging for time you get:
t = (v-u)/a
I’m not exactly sure exactly how JumpPower relates to the character’s initial velocity, but I’m just going to assume it is 1:1.
We can calculate for half the time, by letting it go until v = 0 (when it begins to descend again)
t = (-Humanoid.JumpPower) / (-game.Workspace.Gravity)
the negatives cancel out so it would just become
t = Humanoid.JumpPower / game.Workspace.Gravity
This only gives us HALF the time though, so you just times it by 2
so:
t = 2 * Humanoid.JumpPower / game.Workspace.Gravity
Disclaimer: This was written when I was tired and procrastinating sleeping, so it may not be perfect. should be pretty close though.
After experimenting with this, i came around a problem, if the player lands quicker than they should, on an object that is higher than the ground the time isnt so reliable, what better way is there to detect when the player SHOULD jump? ( this is what i use now ): lua (( 2 * TargetHumanoid.JumpHeight / (workspace.Gravity*TargetHumanoid.JumpPower)) * 2) + 0.5
Edit: OP marked this post as teh solution, making my previous one not marked as the solution. This is response to a slightly different question. The answer to the original question can be found at
That makes it a lot more complicated to calculate.
I’ve re-read your original post (at a more reasonable hour), and for your use case you may be interested in the humanoid state, Landed.
Connect an event up to it and you should be able to determine if they jumped again within X time
i have tried that before but i found states VERY unreliable, for instance if a player doesn’t stop moving while landed the landed state wont ever fire, and sometimes they dont even fire
after some doubting, i have found the root of this issue to be that i handled the event on the server, and there is seemingly a huge delay for it, after experimenting with it on the client it is a lot more accurate, ill try implementing and see how it goes.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.