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:
with loops:
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