How to make an NPC in Roblox Studio with AI
An NPC is a character model with a Humanoid, plus a script that decides what it does: stand and talk, sell things, walk a path or chase players. Tell RoAssistant what the NPC is for and it builds the character and writes its behaviour.
What an NPC is made of
- A character model with a Humanoid and a HumanoidRootPart, the same pieces a player's character has.
- For talking: a ProximityPrompt that shows "Talk" when you are close, and a dialogue screen.
- For walking: PathfindingService, which finds a route around walls instead of walking into them.
- For fighting: a detection range, a damage amount, a cooldown between hits, and health.
- A server script running it, so every player sees the NPC in the same place doing the same thing.
- Something to do when it dies: drop coins, respawn after a delay.
Why build it with RoAssistant
RoAssistant builds the character, writes its behaviour on the server and play-tests it, so you get a working NPC rather than a script to wire up.
What to ask for
Type it the way you would explain it to a friend. For example:
- Make a shopkeeper NPC by the stall. Pressing E on him opens the shop.
- Make a quest giver who asks me to collect 10 apples and pays 100 coins when I return.
- Make a zombie that chases the nearest player, deals 10 damage per hit and respawns after 15 seconds.
Step by step
- Sign in at roassistant.me with your Roblox account.
- Install the free plugin, RoAssistant AI, from the Roblox Creator Store: https://create.roblox.com/store/asset/138810452100215/RoAssistant
- Open your place in Roblox Studio, open the plugin and press Connect.
- Say what the NPC is for: talking, selling, guarding or attacking.
- Say where it stands or which area it patrols.
- Play and walk up to it, or let it find you.
Check that it works
- A talking NPC shows its prompt only when you are close.
- A walking NPC goes around walls and does not get stuck on steps.
- An enemy hits at its cooldown, not many times a second.
- In a two-player test, both players see the NPC in the same place.
Common problems
My NPC walks into walls
It is being told to walk straight at its target. Ask for it to use pathfinding so it routes around obstacles.
The NPC falls over or slides around
Its parts are not joined or one of them is anchored when it should not be. Ask the assistant to check the NPC's rig.
Enemies make the game lag when there are many
Each one is searching for players and a path many times a second. Ask for enemies to look for a new target less often, and to stop when no player is near.
Facts in this post were last checked on .