How To Emulate Directional Push?

Hello, I’m trying to make a directional push when you get attacked similar to this.
https://gyazo.com/759b17018b33695d08d4c06e84059e20

I’m not exactly sure how they did it. I tried shooting a ray from the maincharacters humanoidrootpart to the enemychars humanoidrootpart and then using the direction of that ray but that ended up moving the characters in a weird direction.

my attempt:

local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(1e5,1e5,1e5)
local ray=Ray.new(char:WaitForChild("HumanoidRootPart").Position,v:WaitForChild("HumanoidRootPart").Position)
BV.Velocity = ray.Unit.Direction * 10
local BV2 = BV:Clone()
BV2.Parent = char:WaitForChild("HumanoidRootPart")
game:GetService("Debris"):AddItem(BV2,.24)	

you can just get a cframe to calculate the direction of another person. Rays don’t work for getting directions, only for raycasting.
CFrame.new(PlayerPos, EnemyPos)

CFrame.new(pos, lookat) is deprecated

Well it ain’t gonna be braking soon and it’s easier to use then anything else relating to cframe.
image
VS
image

It’s still sad tho, why removing this…

When they depreciate something they don’t remove it, ever they just stop updating it so it can break. (But I don’t expect it to break any time soon unless they compleatly revamp the cframe system)

local VelCFrame = CFrame.new(char.HumanoidRootPart.Position,v.HumanoidRootPart.Position)
local VelVector = Vector3.new(VelCFrame.X,VelCFrame.Y,VelCFrame.Z)
BV.Velocity = VelVector
local BV2 = BV:Clone()
BV2.Parent = char:WaitForChild("HumanoidRootPart")
game:GetService("Debris"):AddItem(BV2,.24)	

Doesn’t produce the same effect?

VellVector = VelCFrame.LookVector
Then multiply the lookvector for the amount of speed you want

I guess you could try

BV.Velocity = HumanoidRootPart.CFrame.LookVector * 10 --change 10 to your desired speed