Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

When I run this in game it stops halfway through the first song, can someone help me?

local S1 = Instance.new("Sound")
	S1.Name = "Music"
	S1.SoundId = "http://www.roblox.com/asset/?id=154988842"
	S1.Parent = game.Workspace
local S2 = Instance.new("Sound")
	S2.Name = "Music"
	S2.SoundId = "http://www.roblox.com/asset/?id=181462247"
	S2.Parent = game.Workspace
local S3 = Instance.new("Sound")
	S3.Name = "Music"
	S3.SoundId = "http://www.roblox.com/asset/?id=181462282"
	S3.Parent = game.Workspace

local S4 = Instance.new("Sound")
	S4.Name = "Music"
	S4.SoundId = "http://www.roblox.com/asset/?id=181462320"
	S4.Parent = game.Workspace


local S5 = Instance.new("Sound")
	S5.Name = "Music"
	S5.SoundId = "http://www.roblox.com/asset/?id=181462345"
	S5.Parent = game.Workspace

while true do
	wait()
	S1:Play()
	S1.Ended:wait()

	S2:Play()
	S2.Ended:wait()
	
	S3:Play()
	S3.Ended:wait()

	S4:Play()
	S4.Ended:wait()

	S5:Play()
	S5.Ended:wait()
	
end

1 answer

This is really easy to test and it works fine. Needs some organization. Always loop!

local ids = {154988842,181462247,181462282,181462320,181462345}

local sounds = {}

for _,id in ipairs(ids) do
	local new = Instance.new("Sound")
	new.SoundId = "http://www.roblox.com/asset/?id="..id
	new.Parent = workspace
	table.insert(sounds,new)
end

while wait() do
	for _,s in ipairs(sounds) do
		if not s.IsLoaded then s.Loaded:wait() end
		s:Play()
		s.Ended:wait()
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.