Can't turn with BodyVelocity

I’m making a dashing system that adds a BodyVelocity whenever you dash, but I’m not able to turn sideways while dashing. Is there a way to fix this?

Heres my dash function:

function dash(side, front)
local DashVelocity = Instance.new("BodyVelocity")
DashVelocity.MaxForce = Vector3.new(math.huge,0,math.huge)
DashVelocity.P = 99
DashVelocity.Parent = hrp
DashVelocity.Velocity = hrp.CFrame.LookVector * (front * 50) + hrp.CFrame.RightVector * (side * 50)
end
1 Like

Try this with a humanoid.

DashVelocity.Velocity = humanoid.MoveDirection * 50

MoveDirection represents the direction in which the humanoid is attempting to walk. So, this will work for all directions.

1 Like

Use a LinearVelocity instead of a BodyVelocity.

You can edit the properties of the LinearVelocity so it applies force relative to an attachment (in this case, your character’s RootRigAttachment.)

**Also, these should be the properties needed (sorry if it’s wrong, this is from memory):

• Set Attachment0 to the RootRigAttachment (in the HumanoidRootPart)
• Set ActuatorRelativeTo to “Attachment0”
• Set VectorVelocity to Vector3.new(0, 0,- speed) (speed being how fast the dash is)

You may have to experiment with the VectorVelocity and MaxForces, but this should do the trick.

1 Like

you must constantly update the velocity of the dash in order to achieve a turning effect:

function dash(side, front)
local DashVelocity = Instance.new("BodyVelocity")
DashVelocity.MaxForce = Vector3.new(math.huge,0,math.huge)
DashVelocity.P = 99
DashVelocity.Parent = hrp
repeat
wait()
DashVelocity.Velocity = hrp.CFrame.LookVector * (front * 50) + hrp.CFrame.RightVector * (side * 50)
until wait(1)
DashVelocity:Destroy()
end
1 Like

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