Can you use CollectionService for AI pathfinding?

I just want to know if it is possible to use CollectionService for pathfinding.
I don’t want to put individual scripts inside each NPC.

1 Like

I don’t see why not.

I assume you already know what collection service is and how to use it so…
Once the npc model is added if its tagged as NPC_Model or whatever it is… You can just apply the code you want to the model and/or its children however you like.

If you don’t know how to do this, you can try breaking down how collection service works through reading the API reference page and the example at the bottom of the page here:
CollectionService (

If you don’t want to use collection service, you could also simply put a script in your script. And then Duplicate that script into each bot/npc as they are created using another method such as…

if Child.Name == "NPC_Model" then 
local NPC_Script = script.NPC_Script:Clone()
NPC_Script.Parent = Child
NPC_Script.Disabled = false

Idk what your goal is so this code is just to give you ideas.
Good luck!

1 Like