Tables returning and repeating once with CollectionService

I have recently had the hardest time dealing with tables and collection service.
To be fair I can get this working but honestly it seems very dumb the way I am doing it.
Here is a basic script I made that loops NPCS:

local NPCTag = "NPC"

local NPCUtils = {}

function NPCUtils.NPCLoop()
	local npcs = {}
	for _, npc in pairs(CollectionService:GetTagged(NPCTag)) do
		local npcName = npc
		table.insert(npcs, npcName)
	end

	return npcs
end

return NPCUtils

Now I make a basic loop to make a clone for every NPC int he table in a different script (I am trying to modularize it).

local function DisplayQuestIndicators()
	local npcs = NpcUtils.NPCLoop()
	print(npcs)
	for _, npc in pairs(npcs) do
		print(npc)
		local npcName = tostring(npc)

		local npcModel = npcModels[npcName]
		npcQuestIndicator.Adornee = npcModel
		npcQuestIndicator.Enabled = true

		local npcIndicatorModel = npcIndicatorModels[npcName]
		npcIndicatorModel.default.Transparency = 0
	end
end
task.spawn(function()
	DisplayQuestIndicators()
end)

But this always only repeat once, unless I make a runservice connection repeat it for 0.1 seconds and then it works. But honestly I am so lost why all tables return only 1 time in every for loop I write. Am I just horrible at looping through tables?

What are you trying to accomplish here?
Are you trying to make the function DisplayQuestIndicators run constantly??

1 Like

Nope. Doesn’t need too, its just a loop that loops through the table, and by my understand it should make a gui for every NPC right? ITS A LOOP. I can’t seem to figure it out. Now this is a billboard gui and a model part, and it works fine, the problem is with out using run service it only runs once. It also only runs once on the first or second npc, depends on whatever is first or last in the table.

I guess loops return 1 value? only?

Solution is at the top in my edit.