Don’t use BodyVelocity, it’s deprecated. Very sad moment.
Also, I recommend using Humanoid:Move(Vector3) as that will cause the Humanoid to walk in the specified direction from the unit vector. You would need to constantly call that function since the player might walk somewhere else.
I would stick to BodyForce, but use a VectorForce instead, it works basically the same as a BodyVelocity. You wouldn’t be able to use the Humanoid:Move() function because that will be overridden by the characters own movement. (Unless you mess with the default character control scripts which can be very complicated)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(10000, 0, 10000)
BodyVelocity.Velocity = HumanoidRootPart.CFrame.LookVector * 24
BodyVelocity.Parent = HumanoidRootPart
local originalOrientation = HumanoidRootPart.Orientation
local connection = nil
connection = game:GetService("RunService").Stepped:Connect(function()
local newOrientation = HumanoidRootPart.Orientation
if newOrientation ~= originalOrientation then
originalOrientation = newOrientation
BodyVelocity.Velocity = HumanoidRootPart.CFrame.LookVector * 24
end
end)
BodyVelocity.Destroying:Connect(function()
connection:Disconnect()
end)
Edit: A more efficient and clean code version would be using LinearVelocity and setting the attachment to the HumanoidRootPart, so the velocity’s orientation will automatically correct