How should NPC's be handled?

I’m trying to make some advanced NPC’s in a game, and I was wondering, since I’ve been improving I’ve been getting this feeling that placing scripts in the workspace is usually not what professional developers do.

I’ve been starting to just make big scripts in ServerScriptService that manage all the instances that work the same (LavaBlocks for example)

So I was wondering, should the scripts that control the NPC behaviour be inside the NPC or have their own place somewhere else? What’s the most efficient?

(Edit: I’m wondering how successful games do it)


You should use one script and place it in server script service. You can use modules to help too and modules like simple path. You can do a lot of advanced stuff it just depends on what you exactly want.


I’ve seen that video, Is that really what most developers do? Because that’s exceedingly complicated.

1 Like

Depends on what you’re trying to do. For example, tds games most likely use client NPCs, while in other games they might just use one script.

It all depends on what you’re trying to do. But hey, saving performance is always good; even if it’s minor.

But, overall one main script is the way to go. It’s also much more modular too.


Sigh, I understand, I’ll have to learn to make client npcs, tho they seem so incredibly hard, my npcs are just like zombies in a zombie game, so since they’re gonna be alot of them I assume I’d have to do it on the client, I’ll try it on the server first tho, also how would I exactly control all npcs through one main script? coroutines? collectionService?


So how I did it was I created one folder which held all of the NPCs from there I looped through all the NPCs when a child was added with a for loop. I then did a basic NPC system with Simple Path. If you kept it on the server you would stop there.

I would first do everything on the server just to test. If you see lag go client sided.

So for client NPCs, still have NPCs on the server just not rendered. Then render it in the client.

Why not just have everything on the client? Security issues; an exploiter can control everything on the client.


First step is to make a dictionary, which stores data about all npcs. One main script is not necessary, also do not complicate things with client side on your first try. What I think necessary and time saving is module scripts with OOP. Bind some methods to your npc object, and move them with behaviour you want, checking the dictionary about how it moves, attacks etc.


I was trying to avoid whatever OOP is because it seems really complicated, but I guess I’ll have to look into it, any places I can learn what it is?

You will have to learn it eventually. Learning it is not easy, even tho when you learn it, it feels easy. My experience, you have to check many different tutorials about it. What I can give you is B Ricey on youtube and devforum tutorials.

Also open sourced games like Vesteria will help you, as it contains scripts about NPC’s. Although you should learn it first.


I’d recommend checking out Justice the Awesome NPC system by Lewis. Now on v6. I have used it in 2 games and it’s reliable and handles lots of NPCs and can be customised.


Oh wooow, that’s really interesting, I’ll definitely check that out! Thank you so much!

Alright! Thank you so much for the resources to learn it, I’ll look into it asap!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.