How would I use LookVector to make a long jump?

I’m trying to make long jump mechanics, the issue is I don’t know how I’m supposed to use Look Vector nor do I know how to make it so that its were the players direction is.

Here Is The Code:

UIS.InputBegan:Connect(function(input, gameProccess)
	if input.KeyCode == Enum.KeyCode.LeftShift and IsLSDown == true and not gameProccess then
		local Vel = Instance.new("BodyVelocity")
		Vel.Name = "Velocity"
		Vel.Parent = script.Parent.Parent:WaitForChild("Torso")
		Vel.P = 20
		Vel.Velocity = 
	end
end)

Also, how does Look Vector work? I couldn’t find anything related on Roblox API Refrence

lookVector is a member of CFrame. It basically gives you the direction something is looking at.

The code used:

HumanoidRootPart.Velocity = HumanoidRootPart.CFrame.LookVector * 100

1 Like

Would this work then?

UIS.InputBegan:Connect(function(input, gameProccess)
	if input.KeyCode == Enum.KeyCode.LeftShift and IsLSDown == true and state == "running" and not gameProccess then
		local Vel = Instance.new("BodyVelocity")
		Vel.Name = "Velocity"
		Vel.Parent = script.Parent.Parent:WaitForChild("Torso")
		Vel.P = 0
		Vel.Velocity = (HumanoidRootPart.CFrame.LookVector * 100) * Humanoid.WalkSpeed
		for i = 1, 45 do
			wait(0.5)
			Vel.P = Vel.P + i
		end
		wait(3)
		for i = 1, 45  do
			wait(0.5)
			Vel.P = Vel.P - i
		end
		if Vel.P == 0 then
			Vel:Destroy()
		end
	end
end)

Tbh, idk. Try it out. If not, just use HumanoidRootPart.Velocity.

1 Like