Roblox NPCs and pathfinding
Builds Roblox NPCs that path properly and do not lag the server at scale.
Claude's review
7/10 Detailed Roblox pathfinding traps, agent limits and many-NPC scaling patterns.
We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.
In detail
Use when building, fixing or reviewing Roblox NPCs, bots or enemies: PathfindingService, Humanoid movement, ownership, many-NPC cost.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: roblox-npc-ai
description: "Use when building, fixing or reviewing Roblox NPCs, bots or enemies: PathfindingService, Humanoid movement, ownership, many-NPC cost."
when_to_use: "Also when NPCs get stuck, stop mid-path, walk through walls or doors, take odd routes, jitter or teleport near players, paths fail on long or tall maps, client paths miss objects, or many NPCs lag the server."
last_reviewed: 2026-11-29
sources:
- https://create.roblox.com/docs/characters/pathfinding
- https://create.roblox.com/docs/reference/engine/classes/PathfindingService
- https://create.roblox.com/docs/reference/engine/classes/Path
- https://create.roblox.com/docs/reference/engine/enums/PathStatus
- https://create.roblox.com/docs/reference/engine/classes/PathfindingModifier
- https://create.roblox.com/docs/reference/engine/classes/PathfindingLink
- https://create.roblox.com/docs/reference/engine/classes/Humanoid
- https://create.roblox.com/docs/physics/network-ownership
- https://create.roblox.com/docs/workspace/streaming
- https://create.roblox.com/docs/projects/server-authority
- original
---
# Roblox NPC & AI
## When to Load
NPC, enemy or bot movement and upkeep: pathfinding, Humanoid walking, ownership, streaming, server cost of many NPCs. Physics ownership in depth: `roblox-physics` §3; profiling: `roblox-performance`; corpses and ragdolls: `roblox-physics` §2.
"Field case" = seen in one of the owner's projects; verify on your content.
## Traps and review checklist (symptom -> cause -> fix)
- **NPC stops partway on a long leg, `MoveToFinished` returns `false`** -> `Humanoid:MoveTo` times out after 8 s. Keep legs short (waypoints) or call `MoveTo` again on an interval to reset the timer. It also ends on ~1 stud arrival, a new `WalkToPoint`/`WalkToPart`, a `Humanoid:Move()` call, or a script setting the root's `CFrame`, so a teleport or knockback cancels the walk.
- **Path fails or hugs walls for a big or small NPC** -> agent defaults are for a standard character: `AgentRadius` 2, `AgentHeight` 5, `AgentCanJump` true, **`AgentCanClimb` false**, `WaypointSpacing` 4. Gaps lower than `AgentHeight` are unwalkable; a goal reachable only by jumping fails with `AgentCanJump = false`. Size per NPC type.
- **Path to a far target fails though one exists** -> start-to-finish straight-line distance over 3,000 studs fails, and a search can exhaust its 20,000-node budget well before that in open worlds or mazes. Waypoints with bottom Y outside ±65,536 are ignored. Route through intermediate goals.
- **NPC re-paths constantly while fleeing** -> `Path.Blocked` also fires for waypoints **behind** the agent. Recompute only when `blockedWaypointIdx >= nextWaypointIndex`, with a bounded retry; never call the follow function recursively from `Blocked`. `Path.Unblocked` exists for the reverse.
- **Path wades through water or lava** -> default search is shortest (it only tries to avoid jumps). `Costs` keys are `Enum.Material` names as strings or `PathfindingModifier.Label`s; `math.huge` = impassable, a high finite cost (100, 1,000) = last resort.
- **Region cost or `PassThrough` door has no effect** -> the modifier's part must be `Anchored` with `CanCollide = false` and its `Label` must match a `Costs` key. `PassThrough` makes the path go through the door; the NPC still has to open it.
- **Boat, zipline or teleporter never used** -> `PathfindingLink` (`Attachment0` -> `Attachment1`, `Label`) needs a `Costs` entry for its `Label` cheaper than the alternative (`UseBoat = 2` vs `Water = 20`), and your follower must act on the waypoint's `Label` (custom action) instead of walking it. Climb waypoints carry `Label == "Climb"`.
- **Client script can't find the NPC or its parts arrive piecemeal** -> under streaming, server NPCs exist on a client only near its focus. Set NPC models `ModelStreamingMode = Atomic` for client visuals; client pathfinding sees only streamed-in geometry, so target parts in `Persistent` models after `Workspace.PersistentLoaded`, and expect streaming to block or unblock paths mid-walk. Server pathfinding sees the whole world.
- **Path cost spikes when doors or platforms move** -> moving collidable geometry makes the navigation mesh rebuild. Keep moving blockers `CanCollide = false` where gameplay allows, and capture a MicroProfiler trace before blaming the AI loop.
- **Bot reads as "a bot"** -> slow walk speed: 8.5 studs/s was obvious, 11 felt right (field case). Tune reaction delay, aim error and cooldowns instead, with the players' movement numbers.
- **Server lags with many NPCs** -> every live NPC is a server-simulated, replicated Humanoid. Think less often, stagger work, and for crowds keep NPCs virtual (§1); measure at the target count.
...From TabooHarmony's repository, MIT licence.
Related skills
-
Checked
Roblox Luau scripting
Writes well structured Roblox Luau scripts and fixes common errors like LocalScripts that never run.
8/101 credit -
Checked
Roblox simulator economy
Designs upgrade costs, income rates, rebirth pacing and egg odds for Roblox simulator and tycoon games.
8/101 credit -
Checked
Roblox Studio editing
Edits a Roblox place or Rojo project safely and proves each change with the right test before reporting.
7/101 credit -
Checked
Roblox Game Structure
Helps you organise a Roblox game's client and server code, data flow and streaming so it stays secure.
7/101 credit -
Checked
Roblox monetisation
Adds Robux purchases, passes and subscriptions to a Roblox game without losing or double granting sales.
7/101 credit -
Checked
Roblox Physics and Raycasts
Helps you build Roblox hit detection, vehicles and projectiles with modern physics APIs and no jitter or flinging.
7/101 credit