How to make the enemy face at you

https://gyazo.com/dedb96761fc669580d70dc09ca12d789 this is the clip how to make it face player

1 Like

Try this

enemy.HumanoidRootPart.CFrame = CFrame.new(enemy.HumanoidRootPart.CFrame, player.HumanoidRootPart.CFrame)
if hitted.Parent:FindFirstChild("Humanoid") and not hitted:IsDescendantOf(Character) then
		local Enemy = hitted.Parent

HumanoidRootPart is not a valid member of Player “Players.Player1” (x15)

Oops, I meant the player by the player’s character

enemy.HumanoidRootPart.CFrame = CFrame.new(enemy.HumanoidRootPart.CFrame, player.Character.HumanoidRootPart.CFrame)

ServerScriptService.SP.Barrages:33: invalid argument #1 to ‘new’ (Vector3 expected, got CFrame) (x20)

enemy.HumanoidRootPart.CFrame = CFrame.new(enemy.HumanoidRootPart.Position, player.Character.HumanoidRootPart.CFrame)
enemy.HumanoidRootPart.CFrame = CFrame.new(enemy.HumanoidRootPart.Position, player.Character.HumanoidRootPart.Position)

Use the CFrame.LookAt(pos1, pos2) function.

The function takes 2 arguments, the first one being the actual position of your [character/npc/part] to rotate, and the second one being the target position. Both arguments are Vector3 values.
It returns a CFrame positioned at pos1 and oriented towards pos2.

--this is only an example
rootPart.CFrame = CFrame.LookAt(rootPart.Position,target.Position)

reference