How to make NPC looking at player.
✓ ANSWER ACCEPTED
How to make NPC looking at player?
1 answer
✓ Accepted answer
Well, I'm not quite sure what you're asking, but assuming you want a Player-Like NPC to look at a player your code should be a Server Script in the NPC and will look like this:
local NpcPart = script.Parent:WaitForChild("HumanoidRootPart") -- You can change this to any part if your NPC isn't a Player-Like NPC
local PlayerToLookAt = game.Workspace:WaitForChild("ThiagoGamestar").HumanoidRootPart
NpcPart.CFrame = CFrame.new(Vector3.new(NpcPart.Position), Vector3.new(PlayerToLookAt))
-- The Cframe is CFrame.new(The Position you want the NPC to be in, The Position you want the NPC to be looking at
-- IF you want the NPC to constantly to be looking at the player, use this code instead:
local NpcPart = script.Parent:WaitForChild("HumanoidRootPart")
local PlayerToLookAt = game.Workspace:WaitForChild("ThiagoGamestar").HumanoidRootPart
while true do
NpcPart.CFrame = CFrame.new(Vector3.new(NpcPart.Position), Vector3.new(PlayerToLookAt))
wait(0) -- 0 is how long it will wait until the NPC adjusts to look at the player again. (make sure it is at least a 0)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Why my NPC is disappearing?