Hello! I wanted to make an NPC follow and attack a Player but it keeps trying to get to the exact same Position as the HumanoidRootPart, which makes it want to stand on top of them, which disrupts gameplay.
How would I make the NPC move in front of the Player?
I’ve tried them, and I’ve got a result where the enemy just looks at you all the time which bugs the way it walks, and it also messes up my game’s combat. I want it to look at the Player only on a horizontal axis, so that it doesn’t look up or down.
if (TargetRootPart.Position - NPCRootPart.Position).Magnitude <= 5 then
-- TWEEN LOOKING AT AI HERE
local LookAt = CFrame.new(TargetRootPart.Position, NPCRootPart.Position * Vector3.new(1, 0, 1))
It’s not a good fix but should do. I would more recommend applying changes to the Orientation property of RootPart.