# Bodyvelocities being weird

I am trying to make a hit up to a down slam, however the down velocity is very weird, sometimes going a bit to the right, and sometimes going straight up left or right. I’m trying to make it go forward/backward instead of those two X directions

``````					local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(10000, 10000, 10000)
bv.Velocity = Vector3.new(0, 80, 0)
bv.Parent = enemy.HumanoidRootPart
wait(0.4)
local up = Vector3.new(0,70,0)
local forward = Vector3.new(0,0,30)
bv.Velocity = Vector3.new(0,-45,20)
wait(0.5)
bv:Destroy()
``````

Hello there Do you want it to be relative to the player?

Yes, I do want it to be relative to the player.

You should do

``````local playerEnemyDirection = (enemyHumanoidRoot.Position - playerHumanoidRoot.Position).Unit -- This line of code gets a *direction* which is important when making things relative.
bv.Velocity = Vector3.new(0,-45,0) + playerEnemyDirection * 10--How far you want it to go
``````

You have to get the player’s and the enemy’s HumanoidRootPart for this to work.

Then you can create a direction vector from the player to the enemy. To create a direction simple do (Position1 - Position2).Unit for a direction from position2 to position1.

It doesn’t go forward/backward

``````					local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(10000, 10000, 10000)
bv.Velocity = Vector3.new(0, 80, 0)
bv.Parent = enemy.HumanoidRootPart
wait(0.4)
local up = Vector3.new(0,70,0)
local forward = Vector3.new(0,0,30)
local playerEnemyDirection = (enemy.HumanoidRootPart.Position - char.HumanoidRootPart.Position).Unit -- This line of code gets a *direction* which is important when making things relative.
bv.Velocity = Vector3.new(0,-45,0) + playerEnemyDirection * 10--How far you want it to go
wait(0.5)
bv:Destroy()
``````

Does it give an error???

It does not bring up an error, is it because the enemy is higher than the player?

Oh ofc! I see I forgot the player and the enemy must not be on the same plane! There is an easy fix sorry my bad

``````bv.Velocity = Vector3.new(0,-45,0) + (playerEnemyDirection*Vector3.new(1,0,1)) * 10
``````
1 Like

https://gyazo.com/c2905aaa41a23b19c1ee8b11eef65319 Only goes up and down

``````bv.Velocity = Vector3.new(0,-45,0) + ((playerEnemyDirection*Vector3.new(1,0,1)).Unit*10)
``````

Sorry for those mistakes. I think I am too deprived of sleep

Here’s what I am talking about.
https://gyazo.com/65700a8e2200efa556e319ee7cc9b7fb
It always goes to a random direction.

That might be because it is relative to where the player is currently. If you want it to be where the player was before you need to get the direction from the player to the enemy when you activate the move.

Ah I am too tired for this.

Moved it up in the lines to where the move start, but the same issue.

You need to push enemy related to attacking player look vector:

``````--attackingPlayer value is player who did this attack

local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(10000, 10000, 10000)
bv.Velocity = Vector3.new(0, 80, 0)
bv.Parent = enemy.HumanoidRootPart
wait(0.4)
bv.Velocity = attackingPlayer.HumanoidRootPart.CFrame.LookVector*20+Vector3.new(0,-45,0)
wait(0.5)
bv:Destroy()
``````