I am trying to make something that lets a player move forward in the direction that they are facing when holding spacebar. Currently, I’m using a body velocity and changing the velocity to the character’s HumanoidRootPart’s lookvector every frame, but it’s pretty laggy when there’s high ping
heres my script:
activated = true
local bv = Instance.new("BodyVelocity", player.Character.HumanoidRootPart)
bv.MaxForce = Vector3.new(1e8, 1e8, 1e8)
bv.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * 50
bv.Name = "Forward"
spawn(function()
while activated == true do
bv.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * 50
wait()
end
end)
Is there a better way to do this either with or without using body velocity? (also it doesnt need to keep them up in the air)