Guides
Roblox NPC pathfinding: make an enemy that chases players
Build Roblox NPCs with PathfindingService: agent settings, waypoints, blocked paths, costs and modifiers, performance and common fixes.
3 min read

Quick answer
How do you make an NPC follow a player in Roblox?
Use PathfindingService. Create a path with agent settings (radius, height, jumping), compute it from the NPC to the player, then walk the NPC's Humanoid through each waypoint. Recompute the path every so often, and whenever the Blocked event fires. Keep paths under 3,000 studs, and only pathfind when a straight line won't do.
The basics
From Roblox's pathfinding docs:
PathfindingService:CreatePath(agentParams)makes a path object.path:ComputeAsync(startPosition, goalPosition)calculates the route.- Check
path.StatusisSuccess. path:GetWaypoints()gives positions from start to end. Each has anAction, such as Jump.- Move the NPC's Humanoid to each waypoint in turn, jumping when told to.
Agent settings
AgentRadius: default 2, the clearance from wallsAgentHeight: default 5, so gaps lower than this are blockedAgentCanJump: default trueAgentCanClimb: default falseWaypointSpacing: default 4Costs: make some materials or zones more or less attractive
Match these to your NPC. A big monster needs a bigger radius and height, or it'll try to squeeze through doors it can't fit.

Chasing a moving player
Players move, so a path goes stale. A common loop:
- If the NPC can see the player directly (a raycast with nothing in between), just walk straight at them. That's cheaper and smoother.
- Otherwise, recompute the path every half-second to second, and walk the first few waypoints.
- Connect
path.Blockedand recompute when something blocks a waypoint ahead.
Steering the route
- Material costs: all materials cost 1 by default. Set Water to a high cost to avoid it, or
math.hugeto forbid it. - PathfindingModifier: label an area, such as
DangerZone, and give it a cost. Turn onPassThroughto let paths cross things like doors. - PathfindingLink: connect two points the navmesh doesn't, like a ladder or a boat ride.
Common problems
- "No path": goal too far (direct distance over 3,000 studs), the node budget ran out on a complex map, or the agent settings make the route impossible.
- NPC stops and stares: the NPC is anchored, or the next waypoint is unreachable. Recompute.
- NPC gets stuck on corners: increase
AgentRadius. - Client-side pathfinding fails: with StreamingEnabled, targets may not be loaded. Run NPC pathfinding on the server (StreamingEnabled).
Performance
Pathfinding is relatively expensive. With many NPCs:
- Stagger recomputes so they don't all happen on one frame.
- Use direct movement whenever there's line of sight.
- Put sleeping NPCs to rest when no players are near.
The NPC's body
An NPC needs a rigged body to walk convincingly: a Humanoid rig, or a custom rig with an AnimationController. See character models and custom rig not animating.
Make the NPC body in Vi3W
Vi3W turns prompts, concept art or sketches into textured, retopologised meshes (GLB, FBX or OBJ) for monsters, guards and creatures. Rig them with Avatar Setup or Blender, then add the pathfinding above. Vi3W doesn't rig or animate. Make an NPC in Vi3W.
Last reviewed

