My dash system has a problem with dashing the wrong way. Whenever I activate the dash, only when I look at a specific direction will the dash go the right direction. In most cases… it goes the wrong way. How can I fix this?
uis.InputBegan:Connect(function(input, gpe)
if not gpe then
if input.KeyCode == Enum.KeyCode.Q then
local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.Attachment0 = hrp.RootAttachment
linearVelocity.MaxForce = 100000
linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
if hum.MoveDirection ~= Vector3.new(0, 0, 0) then
linearVelocity.VectorVelocity = hum.MoveDirection * 100
else
linearVelocity.VectorVelocity = hrp.CFrame.LookVector * 100
end
linearVelocity.Parent = hrp
task.wait(0.1)
linearVelocity:Destroy()
end
end
end)