How can I make a BodyVelocity with the Humanoid direction

Hey everyone!

What do I want achieve?
I want make a dash system but with the direction of the Humanoid when he walks.

Do you have any videos to show us better what you want achieve?

This is what I want:
and this script goes everywhere
The picture shows the dicrection in the video the Humanoid goes
image
https://streamable.com/hnjnae

And this is my problem As you can see it just go this way:
The picture shows the dicrection in the second video the Humanoid goes
image

https://streamable.com/dxp2u2

So what Have I been Trying so far?
For making nothing complicated you can see the BodyVelocity I have been programming:

local function Dash(studs, look)
	local BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.MaxForce = Vector3.new(10000,1,10000) 
	BodyVelocity.Velocity = studs * look
	BodyVelocity.Parent = HMRP
	wait(1)
	BodyVelocity:Destroy()
end

the other things you can image what I have been creating so far:

input right or left then

Dash(HMRP.CFrame.RightVector, -50)
Dash(HMRP.CFrame.RightVector, 50)

input forward or back then

Dash(HMRP.CFrame.lookVector, 50)
Dash(HMRP.CFrame.lookVector, -50)

but that seems like it just give me 4 directions and not more. How can I fix this

I tried everything to explain you hope you can understand

What is my idea so far?

updating the humanoid direction where he is walking and making there a BodyVelocity but I dont know how to do it.

Some ideas?

Maybe use the MoveDirection property of the humanoid?

local function Dash(studs, look)
	local BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.MaxForce = Vector3.new(10000,1,10000) 
	BodyVelocity.Velocity = Humanoid.MoveDirection * look
	BodyVelocity.Parent = HMRP
	wait(1)
	BodyVelocity:Destroy()
end

Where Humanoid is the variable that contains your character’s humanoid

2 Likes

Hahahah you was so fast. Thanks! ;D

1 Like

Anytime! if you have anymore issues don’t be afraid to make another post!

1 Like

One thing you may want to do is make the direction backwards if the humanoid is not moving.

no why should I do that. Can you explain me?

Ah I understood what you mean. I will do it lemme see