BodyVelocity is not working with lookVector

i am simply trying to push the player forwards to where they are facing

however the BodyVelocity is not moving the HumanoidRootPart, except for when i put in a new Vector3
i’m 100% certain the code is correct

but i really think it could be that i’m using a StarterCharacter but i dont know whats in the character that could be interfering with it

--this one works with a hard coded vector (not in my real code)
--but if i use this, the velocity will not push me where i'm facing
local bv ="BodyVelocity")
bv.Parent = hrp
bv.MaxForce =,0,10000)
bv.Velocity =, 0, 20)

--this one for no apparent reason does not work
local bv ="BodyVelocity")
bv.Parent = hrp					
bv.MaxForce =,0,10000)
bv.Velocity = hrp.CFrame.lookVector * 20
1 Like

You need to wait until the character spawns in. Try adding a task.wait(1) at the top of your script.

i do have that, instead of a task.wait its a characteradded:wait()
but i still tried it and it makes the same result

also did you even read my post? you were quick to assume that i was doing this without the character fully loaded

For what it’s worth, this has a magnitude of 20 * 1.414 which is 28.28 instead of 20. For a fair comparison, you would need to multiply lookVector by about 30.

i dont quite get what you mean by fair comparison but this is not what i’m looking for

i need to know why the bodyvelocity using the lookvector is not working for me, there is no error or anything, it just simply does nothing

The only difference between the two scripts is the Velocity property, right?
What I meant in my last post is that hrp.CFrame.lookVector * 20 has a magnitude of 20, but, 0, 20) has a magnitude of almost 30. Does anything change if you multiply lookVector by 30 instead of 20?

i see what you mean now, but it still doesnt do anything
i should probably note that i tried using higher values before this post, still didnt do anything

1 Like

Tested out some forces and found BodyForce to be particularly useful in this scenario. So if BodyVelocity isn’t necessary for you try this:

The following code is an example and worked on a baseplate. The primary caveat is that I didn’t include friction defiance, the formulas and API for disregarding friction can be found here.

A simple workaround to this would be to just detect when Humanoid.FloorMaterial ~= nil and just increase the multiplier until it overcomes friction.

--// This was tested in a local script, consider reformatting this for server-sided physics
local RS = game:GetService("RunService")

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local hrp = char:WaitForChild("HumanoidRootPart")

--// BodyForce: Applies a basic force using the .Force [vector] to the .Parent
local bodyForce ="BodyForce")
bodyForce.Parent = hrp	

--// We could use v.AssemblyMass, however, that method resulted in disproportionate weight
local function GetMass(model)
	local m = 0
	for _,v in ipairs(model:GetDescendants()) do
		if(v:IsA("BasePart")) then
			m += v:GetMass()
	return m

--// W = F = m * g: formula used

--// We could declare these inside Heartbeat to have it update on the fly, but that would take up more resources
local mass = GetMass(char)
local weight = workspace.Gravity * mass

--// Update the Force to match the HRP LookVector
	bodyForce.Force = hrp.CFrame.LookVector * 1 * weight --// 1 is your changeable multiplier

Hope this helps!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.