NPC System

This is a package that can provide you with a number of options for using NPC’s without needing to code!

Package Name: NPC System

Feel free to reach out on Discord with any questions or drop a comment here!

Package Contents

  • NPC - The NPC primitive with attached logic in script folders
  • NPC Path Node - A locator with logic used with the movement system
  • NPC Action Trigger - A trigger used to trigger actions on a given set of NPC’s


The NPC template is the primitive NPC but with added logic already defined. This allows you to control NPC’s via the various script properties without needing to write and code.


  • Script = npcBaseActionsScript
  • Properties
    • Crouch on Init - When enabled the NPC will crouch when the server starts
    • Emote on Init - When enabled the NPC will emote when the server starts
      • Emote To Play - The emote that the NPC should perform
      • Looping - When enabled it will perform the emote in a loop
        • Loop Time - How long should the NPC wait between performing the emote again
    • Look on Init - When enabled the NPC will look at a given target
      • Look At Target Type - Dropdown for target type between entity and position
        • Target Entity - The instance of an entity that the NPC will look at (if target type is entity)
        • Target Position - The position (Vector3) that the NPC will look at (if the target type is position)


  • Script = npcMovementScript
  • Properties
    • Path Nodes - The instances of “NPC Path Node” that form the route for this NPC
    • Loop - When enabled the NPC will loop back to the start, otherwise they’ll stop at the end
    • Include Start Position - When enabled the spawn location for the NPC will form a position in the route
    • Move on Init - When enabled the NPC will move straight away, otherwise they’ll need triggering from elsewhere
    • Debug - When enabled the script will output data to the console for debugging with


  • Script = npcInventoryViewScript
  • Properties
    • Held Template - The template the NPC should start with (item requires inventoryItemSpecScript from the stock Inventory Package)
    • On Held Item - An event that is called when the NPC is given an item to hold

NPC Path Node

The path nodes are the “checkpoints” that form an NPC’s pre-determined route. At these nodes there are options for what the NPC should do at these points. When placed in the world these nodes can be assigned to the Path Nodes property in the NPCMovement script folder. Each node comes with the following properties…

  • Should Pause - When enabled the NPC will pause here before continuing
    • Pause Length - How long should the NPC pause for
    • Should Pause First - When enabled the NPC will pause BEFORE performing actions otherwise they’ll do the actions first.
  • Should Give Item - When enabled the NPC will receive an item (template) via the inventory system
    • Item to Give - The template that the NPC should receive at this node
  • Actions - An array of pre-determined actions that the NPC can perform
    • Clear Inventory - Clears what they are holding
    • Reset Inventory - Resets the inventory back to the state it was in when the server started (according to NPCInventory properties)
    • Jump - NPC will jump
    • Stand - NPC will stand
    • Crouch - NPC will crouch
    • Stop Looking - NPC will stop looking at their target
  • Should Emote - When enabled the NPC will emote at this node
    • Emote To Play - The emote the NPC will perform at this node

NPC Action Trigger

The action trigger allows you to trigger certain actions on a given set of NPC’s when a player enters the trigger zone. The properties of this trigger are…

  • NPCs - An array of instances of NPCs that this trigger affects
  • Trigger Emote - Trigger an emote on the NPCs
    • Trigger Random Emote - When enabled the NPC will play a random emote from an array
      • Emotes To Trigger - An array of emotes to play randomly (if “Trigger Random Emote” checked)
    • Emote To Trigger - A dropdown of the emote to play (if “Trigger Random Emote” not checked)
  • Look At Player - When enabled the NPC will look at (and track) the latest player to enter the trigger (Note that on exiting the trigger the NPC will check to see about looking at anyone else still in there, otherwise they’ll revert to looking at no-one)
    • Socket To Focus On - Which socket on the player should the NPC look at specifically (‘None’ will look at the player root)

Hi russ, started working with your npcMovementScript this morning. I made some changes on my end that might be beneficial in the official package.

I made changes to npcMovementScript and npcPathNodeScript. I understand recommending changes is unusual, but given the complex nature of NPCs, I thought it’d be better to just “make a pull request”, instead of creating new packages.

The changes are:

  1. add a movement mode to the path node, so we can make the npc walk to a location, run to a location, or sprint to a location.
  2. Added a default movement mode to the npcMovementScript (mainly for including the startPosition in the path)
  3. Refactored the node path to an instance variable. Relying on a PropertyArray is problematic for dynamically setting paths, because PropertyArrays can’t grow or shrink - they’re static
  4. Refactored path initialization into its own method so we can call it programatically
  5. Added a lookAt property to the pathNode, to make the npc look at something when they reach a node.

npcMovementScript.lua (


This all looks great! I’ll take a look and work this stuff in while I’m lookig into some issues reported


I tried to add this to the script, but the npc didn’t run (box was checked) and it stopped moving after it reached the 2nd path node.