Hey developers, i was tryna use body velocity to move my character in a leap foward kinda move, however it doesnt change. what i mean is once its Applied it wont follow the lookvector, so it goes the same direction since the start, instead of moving the way im facing
Hi. The player’s not leaping the way you want it to because you’re not constantly updating and changing the velocity property to follow lookVector of the HumanoidRootPart. Here’s an example on how you can achieve what you want:
local Debris = game:GetService("Debris")
local v11 = Instance.new("BodyVelocity")
local HumanoidRootPart:BasePart = character.HumanoidRootPart
v11.Name = "ForwardVelocity"
v11.MaxForce = Vector3.new(80000, 0, 80000)
v11.Velocity = HumanoidRootPart.CFrame.lookVector.unit * 70
v11.Parent = HumanoidRootPart
-- Constantly updates/changes the velocity property to the HumanoidRootPart's lookVector
task.spawn(function()
while task.wait() and v11.Parent do
v11.Velocity = HumanoidRootPart.CFrame.lookVector.unit * 70
end
end)
Debris:AddItem(v11, 0.3)
That’s just one example. Another thing you can do is use Roblox’s new BodyMovers instead, which in your case would be a VectorForce. It would be better to use the new BodyMovers because you won’t have to update the velocity property using code. Also, the old ones are deprecated and the more Roblox applies updates to their engine, the more the old BodyMovers become buggy. That’s why Roblox wants more devs to use the new ones instead.