BodyVelocity not working

I’m trying to make it so the character goes up and forward when they hit a certain key, everything works fine until the second velocity, where he is supposed to go forward but he only goes up. Here’s how i’m trying to do it:

local vel = Instance.new("BodyVelocity")
		vel.MaxForce = Vector3.new((math.huge),(math.huge),(math.huge))
		vel.Velocity = Vector3.new(0,150,0)
		vel.Parent = HumanoidRP
		debris:AddItem(vel,.5)
		
		local vel2 = Instance.new("BodyVelocity",HumanoidRP)
	    vel2.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	    vel2.Velocity = HumanoidRP.CFrame.lookVector * 65
	    debris:AddItem(vel2,.2)

why is it not working, and could you possibly point out what’s going on?

2 Likes

Try making the Y value on the Vector3 a 0.
For example: Vector3.new(math.huge, 0, math.huge)

Ok so I believe I fixed it

local vel = Instance.new("BodyVelocity")
vel.MaxForce = Vector3.new((math.huge),(math.huge),(math.huge))
vel.Velocity = Vector3.new(0,150,0)
vel.Parent = HumanoidRP

wait(.5)

vel.Velocity = HumanoidRP.CFrame.lookVector * 65
debris:AddItem(vel,.2)

So basically instead of having two BodyVelocity,
I made the original one change to the Velocity of the second one.
You may need to tweak the LookVector distance a bit but this should be the fix.

3 Likes

The solution worked fine, but now that it’s just one velocity the transition between vector3.new(0,150,0) to humanoidrp.cframe.lookvector * 65 looks janky

1 Like