Difference between humanoid.jumppower and humanoidrootpart.velocity.Y? [help plz]

I’m messing around trying to make a custom character class using OOP so i decided to make a jump function that has a parameter (jumppower), if the parameter isnt used then it will just use the default jump like this

self.hum:ChangeState(Enum.HumanoidStateType.Jumping)

or if it does use a paramter then it does this

self.char.HumanoidRootPart.Velocity += Vector3.new(0,jp,0)

so i decided to do a test where i test both jumps from (0,0,0) to see if they can reach a certain block thats 200 studs high.

the default jumppower is set to 50, i did a test where i put this function in a for loop that runs 30 times, with wait(.25), and i tried this using both jump() and jump(50) and it shows that using jump() which is the default jump is able to reach a certain height up but then using jump(50) it doesnt reach it. why?

	print("jump parameter")
	for i = 1,30 do
		char:Jump(50)
		wait(0.25)
	end
end
	print("jump default")
	for i = 1,30 do
		char:Jump()
		wait(0.25)
	end
end

i set the velocity.y to 50 which is the same value jumppower is set to. but obviously they dont work the same because both dont end up with the same result reaching the 200 stud high block. so then how does roblox do their jumps??

im not going to do a function where i set jump power to some value and then activate the jump and then reset it back to what it was originally. that will also cause me problems later.

so this seems like a complicated problem, anyone know?

(im basically asking how do i replicate roblox’s jump system??)

I don’t know how to replicate the jump system, but roblox jumping also cancels all acceleration and velocity on the HumanoidRootPart

since you do += Vector3.new(...), this wouldn’t match when the character has a velocity or acceleration; and when there are any other forces on the custom character, like friction, body movers, collisions

also, gravity might not apply during part of the the upward movement of the roblox jump, you need to check for that too

Yes i was also considering that. I did a test where i set the humanoidrootpart velocity to 0 to cancel out any velocity and then set the Y force that i want.

self.char.HumanoidRootPart.Velocity = self.char.HumanoidRootPart.Velocity * Vector3.new(1,0,1) + Vector3.new(0,jp,0)

i tried this and it still didnt reach the platform.

Roblox does use Gravity for jumppower Humanoid.JumpPower

i checked the velocity in HRP using both methods and it showed that default jumping can reach 53 at most and the custom one couldnt be more than 50.

1 Like

it’s influenced by gravity after applying the impulse/velocity at the beginning
you need to check which it does
if you’re setting the velocity, then it won’t be consistent with gravity if they set the impulse

also, you can’t set the current acceleration

1 Like

i tested to see what the velocity was in HRP for both jumps and it showed that

jump() with jumppower set to 50 was able to reach 52.9999999

image
image

how is that possible if its jumppower is set to 50? this definitely means roblox does this is some different way

and then i tested the custom one and it can only reach 50 at max

image
image

1 Like

maybe the roblox jump uses impulse, e.g., 50Newtons for 0.5 seconds
and this would allow the max speed during a jump to change based on things like gravity and the mass of the body

1 Like

i think it simply means that roblox scales the number up. just do something like 50*some abitrary constant, and keep tweeking the constant till the jumps are around the same lenght

1 Like