roblox-npc-ai

Installation
SKILL.md

NPCs and AI

Architecture

  • NPC logic runs on the server (authoritative targets, damage, drops). Visual extras (idle animations, nameplates, effects) can run on clients.
  • One NPC service drives all NPCs from a single loop (e.g. 5–10 Hz "think" rate, staggered), not one script + while true per NPC. Tag NPC models (CollectionService) and keep per-NPC state in a table.
  • Server-owned physics: npc.PrimaryPart:SetNetworkOwner(nil) after spawning, so NPCs don't stutter when ownership moves between nearby players (and exploiters can't push them).
  • Use Humanoid for NPCs that need walking/jumping/climbing; for simple movers (turrets, floating enemies, crowds) use an AnimationController + Animator and move with constraints or CFrames.

Pathfinding

--!strict
local PathfindingService = game:GetService("PathfindingService")
Installs
154
GitHub Stars
29
First Seen
Sep 29, 2026