RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"NPC that stalks and kills"
-- server script local PathfindingService = game:GetService("PathfindingService") local NPC = game.Workspace.NPC local target = game.Workspace.Target -- This can be replaced with the player's character local path = PathfindingService:CreatePath() local waypoints = {} while true do path:ComputeAsync(NPC.HumanoidRootPart.Position, target.HumanoidRootPart.Position) waypoints = path:GetWaypoints() for _, waypoint in ipairs(waypoints) do NPC.Humanoid:MoveTo(waypoint.Position) NPC.Humanoid.MoveToFinished:Wait() end if (NPC.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude < 5 then target.Humanoid.Health = 0 end wait(1) end