How can I copy an instance into multiple models with CollectionService?

I would like to use CollectionService to clone a script instance and paste it into multiple models. No, I do not want to run the script directly through CollectionService. I just want to paste the script instance I have into multiple models that I already have in a table.

I tried to do this:

local npcModels = CollectionService:GetTagged("NPC")

local AI = script.AI:Clone()
AI.Parent = npcModels

It did not work because I can only parent an instance to another instance, and not to a table. How could I achieve this?

1 Like

I have found a solution in this post after digging for a good while.

This is what I did:

for i,v in pairs(Models) do
	local Clone = MyScript:Clone()
	Clone.Parent = v
	Clone.Enabled = true

May this solution be of good use to anyone who needs it.

1 Like

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