How to fix my dash going different direction when facing other way

I’m struggling fix my dash going different direction when I facing the different way, how do I fix it. Its a Front + Left Dash

https://gyazo.com/96af00da11627cafc39ebe677828c37f

My code

local Velocity = Speed

	local BV = Instance.new("BodyVelocity",Character.HumanoidRootPart)
	BV.MaxForce = Vector3.new(100000,20000,100000)
	BV.P = 4000
	BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector * Velocity + Vector3.new(Velocity,0,0)

	RunService.Heartbeat:Connect(function()
		if Velocity > 0 then
			Velocity -= Minus
		else
			BV:Destroy()
		end

		BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector * Velocity + Vector3.new(Velocity,0,0)
	end)

Just to make sure i’m understanding the question:

What you want:

  • You want to dash in the direction you face

What’s happening instead:

  • For some reason when you dash, it’s slightly offset from where you’re looking

Does all that sound right?

Never mind I did a bit more of a thorough look through your code, and this should fix your problem.

local Velocity = Speed

local BV = Instance.new("BodyVelocity",Character.HumanoidRootPart)
BV.MaxForce = Vector3.new(100000,20000,100000)
BV.P = 4000

RunService.Heartbeat:Connect(function()
	if Velocity > 0 then
		Velocity -= Minus
	else
		BV:Destroy()
	end

    local root = Character.HumanoidRootPart
    local orientation = root.CFrame - root.CFrame.Position
	BV.Velocity = (orientation * CFrame.new(-Velocity, 0, -Velocity)).Position.Unit
end)

Again it was a bit hard to understand your question, but from the sounds of it, you want this script to dash you forward, and to the left right? Basically the same if you were to hold the left and forward direction keys (W + A on a qwerty keyboard)

Yeah, this is what am I looking for. I am struggling with creating 1:1 Haze Piece Dash and Double Jump. Would you able to assist me in the double jump too if I open a new problem?

1 Like

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