Player character always moving forward

It’s me, hi! Straightforwardly, I want the character to automatically move forward, without the user input (pressing movement keys in keyboard).

I’ve tried to use BodyVelocity (you can laugh) but it made the character stuck in one direction

(this is serverscript)

BV = Instance.new("BodyVelocity")

BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = HRoot.CFrame.LookVector*50
BV.Parent = HRoot

thank you in advanced for helping!

3 Likes

This should fix your problem

local bodyvelocity = Instance.new("BodyVelocity")
bodyvelocity.MaxForce = HRoot.CFrame.LookVector * 50
bodyvelocity.Velocity = HRoot.CFrame.LookVector * 50
bodyvelocity.Parent = HRoot

Here you should set your MaxForce to the LookVector (aka where the player is facing) because you were applying force on each axis so it wasn’t moving.

1 Like

LookVector is a Vector3 Value.

It even says Vector

If you have a PrimaryPart selected for your character model, you can use Model:MoveTo() to move it in the direction.

He doesn’t want to really move it at a specific position though I guess.

Anyway,

I think you are looking for BodyForce rather than BodyVelocity, Correct me if I’m wrong,

But then again, Both of them are Deprecated?

I think you should use the new BodyMovers.

1 Like

Well if you do…

Character:MoveTo(HRoot.Position + HRoot.CFrame.LookVector*50)

it will ideally move the model in the forward-facing direction.

But if player presses a movement key, it would move.

No?

I think you are confusing Model:MoveTo() with Humanoid:MoveTo()

(maybe…)

Hmmm, I was confused. Ok that would technically work.

Ok, so I have a script which used BodyVelocity but it worked quite well.

It was a fly script with BodyAngularVelocity (just to make it a little bit funny) -

local player = game.Players.LocalPlayer
local character = player.Character
local UIS = game:GetService("UserInputService")
local hrp = character:WaitForChild("HumanoidRootPart")

local fly = false

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Space then
		local bodyvelocity = Instance.new("BodyVelocity")
		bodyvelocity.Name = "Velocity"
		bodyvelocity.Parent = hrp
		bodyvelocity.Velocity = Vector3.new(0,50,0)
		bodyvelocity.MaxForce = Vector3.new(0,10000,0)
		local AV = Instance.new("BodyAngularVelocity")
		AV.Name = "Rotation"
		AV.MaxTorque = Vector3.new(0,100000,0)
		AV.Parent = hrp
		AV.P = 30
		AV.AngularVelocity = Vector3.new(0,180,0)
	end
end)

UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Space then
		hrp:FindFirstChild("Velocity"):Destroy()
		hrp:FindFirstChild("Rotation"):Destroy()
	end
end)

But with this, BodyVelocity worked quite well.

Try using the new body mover LinearVelocity. There you can assign a VectorVelocity and change the MaxForce property between your choice of number and 0, effectively toggling the constraint.

1 Like

Honestly, I haven’t worked much with it because old BodyMovers were convenient. But I made this script (it’s weird) but it didn’t still worked.

local LV = Instance.new("LinearVelocity")
LV.MaxForce = math.huge
LV.RelativeTo = Enum.ActuatorRelativeTo.World
LV.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
LV.VectorVelocity = script.Parent.CFrame.LookVector * 50
LV.Parent = script.Parent

I edited my above post, I recommend you to delete it please.

If my first post helped you, don’t forget to mark it as solution.