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

Why does this only work in studio?

So trying to make it so after a song it picks a new one if theres no queued song.It only is working in studio and only plays the same song and stops after it in game. Ive taken precautions to help stop it, but nothing is working. what do i do?

local MusicBrick = workspace.MusicPlayer local Queue = game.ServerStorage.SongQueue

local MusicBrick = workspace.MusicPlayer
local Queue = game.ServerStorage.SongQueue

while wait() do
	if Queue.S1.Value == "Blank" then -- No songs in queue
		local songs = MusicBrick:GetChildren()
		while true do
		song = songs[math.random(1, #songs)]
		repeat wait() until song ~= nil
		if song:IsA("Sound") then break end
		end
		song:Play()
		song.Ended:wait()
	elseif Queue.S1.Value ~= "Blank" then -- Song in Queue
		MusicBrick[Queue.S1.Value]:Play()
		local song = MusicBrick[Queue.S1.Value]
		Queue.S1.Value = Queue.S2.Value
		Queue.S2.Value = Queue.S3.Value
		Queue.S4.Value = Queue.S5.Value
		Queue.S5.Value = "Blank"
		song.Ended:wait()
	end
end

2 comments

0

Probably not related, but you're missing Queue.S3.Value = Queue.S4.Value.

0

omg your right qq

1 answer

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