MCPInstall

roblox-npcs

Build or debug Roblox NPC navigation and behavior. Use for PathfindingService, modifiers and links, blocked paths, patrol or chase logic, streaming, and scaling NPC counts.

Installs
280
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/nonlooped/roblox-suite --skill roblox-npcs
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads roblox-npcs automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

roblox-npcs

Official sources:

Use PathfindingService for navigation on Roblox's navigation mesh. Build patrol, chase, and other behavior around its computed paths.

PathfindingService basics

Create a path:

local PathfindingService = game:GetService("PathfindingService")

local path = PathfindingService:CreatePath({
    AgentRadius = 2,
    AgentHeight = 5,
    AgentCanJump = true,
    AgentCanClimb = false,
    WaypointSpacing = 4,
    Costs = {
        Water = 20,
        DangerZone = math.huge,
    }
})
path.CalculationSecondsTimeout = 1

Compute and follow:

local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")

local success, err = pcall(function()
    path:ComputeAsync(rootPart.Position, endPos)
end)

if success and path.Status == Enum.PathStatus.Success then
    local waypoints = path:GetWaypoints()
    -- follow waypoints with Humanoid:Move()
end

Agent parameters

ParameterDefaultPurpose
AgentRadius2 studsMinimum clearance from obstacles
AgentHeight5 studsVertical clearance
AgentCanJumptrueAllows jump waypoints
AgentCanClimbfalseAllows climbing truss parts
WaypointSpacing4 studsDistance between intermediate waypoints
CostsnilMaterial/region/link traversal cost

Path.CalculationSecondsTimeout limits how long the solver may run per ComputeAsync call. Set it after CreatePath and before computing.

PathWaypoint actions

Each waypoint has a Position and an Action:

  • Enum.PathWaypointAction.Walk: normal movement.
  • Enum.PathWaypointAction.Jump: trigger jump.
  • Custom labels like "Climb" or "UseBoat" from PathfindingModifiers/Links.

Pathfinding modifiers

PathfindingModifier instances on anchored, non-colliding parts let you influence path cost:

  • Label: key used in Costs table.
  • PassThrough: if true, the volume is ignored by the navmesh and treated as traversable empty space (e.g., zombies "hearing" through doors).

Example:

local path = PathfindingService:CreatePath({
    Costs = {
        Water = 20,
        DangerZone = math.huge,
        UseBoat = 2,
    }
})

Pathfinding links

PathfindingLink connects two Attachments with a custom label and cost, allowing paths across normally untraversable gaps.

Use for:

  • Boats across water
  • Teleporters
  • Ladders
  • One-way jumps

Your movement code checks the waypoint label and runs the custom traversal logic.

Movement patterns

Follow

Continuously recompute a path to a moving target. Throttle recomputation (e.g., every 0.5–1 s) and only recompute if the target moved far enough.

Patrol

Cycle through a list of fixed points. Recompute when blocked.

Chase

Like follow, but validate line-of-sight and distance server-side. Don't trust client-reported positions for authoritative AI.

State machine

Common NPC states: Idle, Patrol, Chase, Attack, Return. Each state handles its own path computation and Humanoid control.

Streaming compatibility

  • Server-side scripts have full world state and can compute paths to any part.
  • Client-side scripts may fail if the destination has streamed out. Use workspace.PersistentLoaded and persistent models for client path destinations.
  • Recompute paths when dynamic/streamed obstacles block the way.

Limitations

  • Direct line-of-sight distance ≤ 3,000 studs.
  • Computation node budget ≈ 20,000 nodes.
  • Waypoint Y coordinate must be between -65,536 and +65,536 studs.
  • Incompatible parameters (e.g., AgentCanJump = false to a jump-only destination) will fail.

Performance at scale

  • Recompute paths on a staggered schedule, not every frame.
  • Share target positions across similar NPCs when possible.
  • Use WaypointSpacing = math.huge to reduce intermediate waypoints for long straight runs.
  • Consider simplifying agent geometry or using fewer active agents.
  • For very large worlds, split into regions or use local patrol paths.

Common mistakes

  • Computing paths every frame.
  • Ignoring blocked-path events and letting NPCs walk into walls.
  • Trusting client position for authoritative AI.
  • Forgetting pcall around ComputeAsync.
  • Using material names incorrectly in Costs (must match Enum.Material names as strings).

Scripts

  • scripts/NPCPathFollower.lua: Humanoid-based path follower with blocked-path recompute, custom-label support, and connection cleanup.
  • scripts/PatrolBehavior.lua: state-driven patrol/chase behavior with spatial detection and throttled recomputation.
  • scripts/PathfindingUtility.lua: helpers for throttled recomputation and waypoint formatting.

Best practices

  • Set Path.CalculationSecondsTimeout after CreatePath to cap solver time.
  • Always set an explicit Humanoid:MoveTo timeout and cancel it when the waypoint is reached or the follower is stopped.
  • Detect targets with spatial queries such as workspace:GetPartBoundsInRadius instead of scanning every player each frame.
  • Stop path followers and clean up Heartbeat connections when the Humanoid dies or the NPC is destroyed.
  • For respawning NPCs, create a new behavior instance for the new character model and Destroy the old one.
  • Use PathfindingLink labels to trigger custom traversal logic (boats, teleporters, ladders). The follower invokes a registered handler; if none exists, the waypoint falls back to normal movement.
  • To enable climbing, set AgentCanClimb = true and provide TrussPart surfaces. Climb waypoints have the Label "Climb".
  • PathfindingModifier parts must be Anchored = true and CanCollide = false.

How to proceed

  1. Define the agent's size and movement abilities.
  2. Build the world with modifiers/links for special regions.
  3. Implement a path-follower that handles waypoints, jumps, and blocked events.
  4. Layer a state machine for complex behaviors.
  5. Run on the server for authoritative AI; use client only for visual prediction.
  6. Profile with MicroProfiler and stagger recomputation for many agents.
<!-- catalog:references:start -->

Reference index

  • modifiers-links-and-streaming.md: Route NPCs through special regions or handle streamed geometry.
  • npc-behavior-patterns.md: Implement patrol, chase, combat, or state transitions.
  • pathfinding-service-details.md: Configure agents, compute paths, or handle blocked waypoints.
  • performance-and-scaling.md: Reduce pathfinding and simulation cost as NPC counts grow.
<!-- catalog:references:end -->

FAQ

What does the roblox-npcs skill do?

Build or debug Roblox NPC navigation and behavior. Use for PathfindingService, modifiers and links, blocked paths, patrol or chase logic, streaming, and scaling NPC counts.

How do I install roblox-npcs?

Run npx skills add https://github.com/nonlooped/roblox-suite --skill roblox-npcs in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/roblox-npcs/ (personal) or .claude/skills/roblox-npcs/ (project).

Which AI agents can use roblox-npcs?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is roblox-npcs safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains roblox-npcs?

It is published by nonlooped in nonlooped/roblox-suite. It has 280 recorded installs.

More from nonlooped/roblox-suite

View all →

roblox-vfx

nonlooped/roblox-suite

Build or optimize Roblox particles, beams, trails, and highlights. Use for emitter shapes, flipbooks, one-shot bursts, animation-marker effects, distance culling, and overdraw.

Frontend & Design685 installs

roblox-animation

nonlooped/roblox-suite

Build or debug Roblox character animations, IK poses, animation-marker events, and UI or object tweens. Use for locomotion, emotes, motion blending, and timed effects.

Frontend & Design414 installs

roblox-user-interfaces

nonlooped/roblox-suite

Build or debug Roblox HUDs, menus, and world-space interfaces. Use for GUI containers, responsive layouts, input handling, ViewportFrame previews, and particle effects in 2D UI.

Frontend & Design341 installs

roblox-testing

nonlooped/roblox-suite

Test, debug, or profile Roblox experiences. Use for Studio debugging, TestEZ, logging, connection cleanup, memory or network diagnostics, MicroProfiler, Scene Analysis, and Script Profiler.

Testing & QA330 installs

roblox

nonlooped/roblox-suite

Open the skill to read its SKILL.md instructions.

322 installs

roblox-mcp

nonlooped/roblox-suite

Connect an AI client to Roblox Studio through MCP. Use for connection setup, Studio tools, multiple Studio windows, playtesting, or combining MCP with Script Sync.

AI & Agents321 installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.