RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"npc that follows you"
-- server script local PathfindingService = game:GetService("PathfindingService") local npc = game.Workspace.NPC local destinationPart = game.Workspace.MoveToPart while true do local players = game:GetService("Players"):GetPlayers() for _, player in ipairs(players) do local character = player.Character if character then local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if humanoidRootPart then local path = PathfindingService:CreatePath() path:ComputeAsync(npc.HumanoidRootPart.Position, humanoidRootPart.Position) for _, waypoint in pairs(path:GetWaypoints()) do npc.Humanoid:MoveTo(waypoint.Position) npc.Humanoid.MoveToFinished:Wait() end end end end wait(1) end