Only a single NPC "activates"

Now, this code works fine and all, but the biggest issue that it will only start a single NPC when its supposed to make all of them start up and start doing whatever.

For example, theres 3 Mindless placed ingame, I press start, only one will do anything and the rest will remain idle.

for _, Mindless in collectionService:GetTagged("MindlessTitan") do
	local mindlessTarget = nil

	local MindlessHumanoid = Mindless:WaitForChild("Humanoid")
	local MindlessPrimaryPart = Mindless:WaitForChild("HumanoidRootPart")

	local walkTrack = MindlessHumanoid:LoadAnimation(MindlessWalk)
	local idleTrack = MindlessHumanoid:LoadAnimation(MindlessIdle)

	local titanPath = pathfindingService:CreatePath({
		AgentRadius = 20 * Mindless:GetScale(),
		AgentHeight = 29 * Mindless:GetScale(),
		AgentCanJump = false,
		AgentCanClimb = false,
		WaypointSpacing = 44 * Mindless:GetScale()
	})

	MindlessHumanoid.Running:Connect(function(speed)
		if speed > 0.1 then
			walkTrack:Play()
			idleTrack:Stop()
		else
			walkTrack:Stop()
			idleTrack:Play()
		end
	end)

	runService.Heartbeat:Connect(function()
		SetMindlessTarget(Mindless, mindlessTarget, MindlessPrimaryPart, MindlessHumanoid, titanPath)
	end)

	mindlessTarget:FindFirstChild("Humanoid").Died:Connect(function()
		SetMindlessTarget(Mindless, mindlessTarget, MindlessPrimaryPart, MindlessHumanoid, titanPath)
	end)
end

these :Connect() things arent loop… so I guess some of your functions have a loop maybe?

For example:

local function test()
    while wait() do
        print('hello')
    end
end

wait(5)
test()
wait(2)
print('hello2')

this will print “hello” every frame after 5 seconds, but it wont print “hello2” because the loop inside function never ends.