Help on custom jump system

I’m trying to make a jump system that is more realistic then the roblox jumping system but, im stuck on how to make the x and z values change correctly depending on if you are standing still or moving. I’ve tried using the HumanoidRootPart.Velocity the Humanoid.MoveDirection and some other things to get this right but I can’t seem to get it right.

This is my code

local function Jump() Values.Jumping = true 
	
	
	local CF = HumanoidRootPart.CFrame.LookVector  
	local NewPosition = HumanoidRootPart.Position + HumanoidRootPart.Velocity
	
	
	JumpAnim.KeyframeReached:Connect(function(KeyFrmae) 
		
	if KeyFrmae == "Up" then
	Humanoid.AutoRotate = false ; Humanoid.WalkSpeed = 0 ; BP.MaxForce = Vector3.new(math.huge,math.huge,math.huge)	
	BP.Position = Vector3.new(NewPosition.X,HumanoidRootPart.Position.Y + 10,NewPosition.Z)    
	
		
		
	else if KeyFrmae == "Down" then
	BP.MaxForce = Vector3.new(0,0,0) BP.Position = Vector3.new(0,0,0) 
			
			
			
	else if KeyFrmae == "Done" then
	Humanoid.AutoRotate = true ; Humanoid.WalkSpeed = 16 
				
				
	wait(0.3) ; Values.Jumping = false 
				
				
			end		
		end	
	end
end)
	
	JumpAnim:Play(0.3) 
	
	
	
	
end 	
1 Like

Create a value in the player called “Running”
Then in that create a script that checks if they are running and then sets the running value to true

Then in the main script do what you need to do from that

You could try setting the BP.MaxForce = Vector3.new(0,math.huge,0) instead? That way it shouldn’t mess with any horizontal movement.

you could try this, worked for me:

humanoid.StateChanged:Connect(function()
	local CF = humanoidRootPart.CFrame.LookVector  
	local newPosition = humanoidRootPart.Position + humanoidRootPart.Velocity/1.75

	if humanoid:GetState() == Enum.HumanoidStateType.Jumping then
		humanoid.AutoRotate = false
		BPF.MaxForce = Vector3.new(1100,0,1100)	
		BPF.Position = Vector3.new(newPosition.X,humanoidRootPart.Position.Y,newPosition.Z)    
	elseif humanoid:GetState() == Enum.HumanoidStateType.Landed then
		humanoid.AutoRotate = true
		BPF.MaxForce = Vector3.new(0,0,0)	
		humanoid.WalkSpeed = game.StarterPlayer.CharacterWalkSpeed
	end
end)

Really off-topic, but this thread was posted more than a year ago, just thought I should tell you in case you didn’t notice. The person who originally posted this also hasn’t been on for 9 months.