How To Move NPC Towards Player With Body Velocity

So how would I use body velocity to move the npc towards the player?
Currently I have it where the npc gets launched forward.

Current Script:

local Bv = Instance.new("BodyVelocity")
			Bv.MaxForce = Vector3.new(100000,100000,100000)
			Bv.Velocity = rp.CFrame.LookVector * 50
			Track:Play()	 --animation
			Bv.Parent = rp
			Debris:AddItem(Bv,0.3)		
1 Like

Nevermind just figured it out, I had a brain fart. Anyways for those who want to know.

for i, player in pairs(game.Players:GetChildren())do
	local Bv = Instance.new("BodyVelocity")
	Bv.MaxForce = Vector3.new(100000,100000,100000)
	Bv.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * 50
	Track:Play()	
	Bv.Parent = rp
	Debris:AddItem(Bv,0.3)	
end
4 Likes

if i am understanding what you are trying to do this should face the npc before applying the velocity

local Bv = Instance.new("BodyVelocity")
Bv.MaxForce = Vector3.new(100000,100000,100000)
rp.CFrame = CFrame.new(Rp.Position,Character.HumanoidRootPart.Postion)  -- this will make the npc first turn towards the player  - you can tween this with a wait for tween to complete to make it smoother
Bv.Velocity =  rp.CFrame.LookVector * 50   -- then move forwards with your velocity
Track:Play()	 --animation
Bv.Parent = rp
Debris:AddItem(Bv,0.3)	

what you have there will apply velocity from the players facing direction not the npc facing back towards the player

2 Likes