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

Tiny bit of help with this music playlist?

Hi, I wanted to put this music playlist in my roblox game and have it repeat, but whenever the first song ends, the next one queued won't play. Can someone tell me what I am doing wrong?

repeat game.Workspace.Sound:Play() length = game.Workspace.sound.TimeLength wait (length) game.Workspace.sound.SoundId = 'rbxassetid://47330098' game.Workspace.Sound:Play() wait (length) game.Workspace.sound.SoundId = 'rbxassetid://246133596' game.Workspace.Sound:Play() wait (length) game.Workspace.sound.SoundId = 'rbxassetid://160288504' game.Workspace.Sound:Play() wait (length) game.Workspace.Sound:Stop()

until false

Any help is appreciated + Thanks in advance!

2 answers

First, you should really use the codeblock function of the question/answer thingy majig

repeat game.Workspace.Sound:Play()
	 length = game.Workspace.sound.TimeLength
	 wait (length)
	 game.Workspace.sound.SoundId = 'rbxassetid://47330098' 
	game.Workspace.Sound:Play() wait (length) game.Workspace.sound.SoundId = 'rbxassetid://246133596'
	 game.Workspace.Sound:Play() wait (length) game.Workspace.sound.SoundId = rbxassetid://160288504' 
	game.Workspace.Sound:Play() wait (length) game.Workspace.Sound:Stop()

until false

also, this could be more organized with tables and loops that are not repeat until false loops.

local soundids = {}
local sound = Instance.new("Sound",game.Workspace)

while true do
	for i,v in pairs(soundids) do
		local _sound = sound:Clone()
		_sound.SoundId = "rbxassetid://"..v
		_sound:Play()
		wait(5)
		_sound:Destroy()
		wait(_sound.TimeLength)
		_sound:Stop()
		print("done done")
	end
end

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