So I made this script to enchant my original npc following script (Because the original one would just go on a strait line
But It appears to not follow the player
local NPC = script.Parent --Describes the humanoid
local PathfindingService = game:GetService("PathfindingService") ---Makes a varibel of PathfindingService
local Players = game.Players
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
while wait() do
local path = PathfindingService:CreatePath()
path:ComputerAsync(NPC.Torso.Position, char.Humanoid.Torso.Position)
local waypoints = path:GetWaypoints()
for i, waypoints in pairs(waypoints) do
NPC:MoveTo(waypoints.Position)
NPC.MoveToFinish:Wait(5)
end
end
end)
end)
while wait() do
NPC:MoveTo(char.Humanoid.Torso.Position)
end
