Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make the npcs head folow the player?

IN cook burgers here The npcs head always follows the player i thought it looked cool how do I do it thought?

1 comment

0

Try using pathfinding services or something similar

1 answer

✓ Accepted answer

function findTorso(pos) local torso = nil local dist = 100000 local child = workspace:children() for i=1, #child do if child[i].className == "Model" then local h = child[i]:findFirstChild("Humanoid") if h ~= nil then local check = child[i]:findFirstChild("Head") if check ~= nil then if (check.Position - pos).magnitude < dist then torso = check dist = (check.Position - pos).magnitude end end end end end return torso end

game:GetService("RunService").Stepped:Connect(function() local torso = findTorso(script.Parent.Position) if torso ~= nil then script.Parent.CFrame = CFrame.new(script.Parent.Position, torso.Position) end end)

Put this script in the Head of the NPCs and make it sure its anchored or the head will just come after the player.

This discussion is preserved as it was. New answers, comments, and votes are closed.