I am following a roblox wiki tutorial but the script seems to not be working, the code is contained in a localscript inside of the npc, I get no errors when I run the game but alas the npc will not move. the npc is r6
-- Variables for the npc and its humanoid local npc = game.Workspace.NPCmodel local humanoid = npc.Humanoid -- Variables for the point(s) the npc should move between local pointA = game.Workspace.coffeeMachine local pointB = game.Workspace.Model -- Move the npc to the primary part of the green flag model humanoid:MoveTo(pointA.PrimaryPart.Position) -- Wait until the npc has reached its first target humanoid.MoveToFinished:Wait() -- Move the npc to the primary part of the purple flag model humanoid:MoveTo(pointB.PrimaryPart.Position)
try to remove primary part
-- Variables for the npc and its humanoid local npc = game.Workspace.NPCmodel local humanoid = npc.Humanoid -- Variables for the point(s) the npc should move between local pointA = game.Workspace.coffeeMachine local pointB = game.Workspace.Model -- Move the npc to the primary part of the green flag model humanoid:MoveTo(pointA.Position) -- Wait until the npc has reached its first target humanoid.MoveToFinished:Wait() -- Move the npc to the primary part of the purple flag model humanoid:MoveTo(pointB.Position)
also make sure that the NPC don't have anything anchored, arms, head, torso, etc.
Localscripts will not work inside of an NPC. From what i can see, this is the only error.
LocalScripts only work when used as a descendant to the player or player's character
Consider changing to a server script (aka a normal script)