Collection Service breaks when attempting to use loops

I am using a collection service script to automate boombox’s that play songs within a playlist

When I attempt to have more than one boombox, only one of them is chosen rather than all of them.

It appears that when I remove the while + for loop from my code, everything works as intended

without loops:
image

with loops:
image

This also could have nothing to do with loops, I’m not really that sure what the problem is

local CollectionSerivce = game:GetService("CollectionService")

for i, Boombox in pairs(CollectionSerivce:GetTagged("Boombox")) do
	
	print(Boombox)
	
	local Sounds = game.ServerStorage.Boombox.Sounds:GetChildren()
	local Modifiers = game.ServerStorage.Boombox.Modifiers:GetChildren()
	
	
	while true do task.wait()

		for i, sound in pairs(Sounds) do	

			local currentSound = sound:Clone()
			currentSound.Parent = Boombox

			for i, modifier in pairs(Modifiers) do

				local currentModifier = modifier:Clone()
				currentModifier.Parent = currentSound

			end

			currentSound:Play()

			currentSound.Ended:Wait()

			currentSound:Destroy()
		end

	end
	
end

The script gets stuck in the infinite while loop when you add it in. That’s why it only prints once. To fix this, spawn the while loop to run it on a different core

task.spawn(function()
   while true do task.wait()

		for i, sound in pairs(Sounds) do	

			local currentSound = sound:Clone()
			currentSound.Parent = Boombox

			for i, modifier in pairs(Modifiers) do

				local currentModifier = modifier:Clone()
				currentModifier.Parent = currentSound

			end

			currentSound:Play()

			currentSound.Ended:Wait()

			currentSound:Destroy()
		end

	end
end)