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 loop in studio?(Unsolved)

It works just fine in studio. but online it only plays the same song once everytime then it stops

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

9 comments

0

Are you sure the queue is ever changing?

0

It shouldnt need to if its blank shouldnt it?

0

Ah true. Have a print statement after your two .Ended:wait()s to see if that is an issue.

0

Ahhhhh it doesnt print Ended

0

But it DOES do it in studio..

0

It may be true, then, that the .Ended event is not working...I'd check the wiki.

0

idk, i dont see a reason why it wouldnt work unless i NEED the soundid in the parentheses

0

but if i needed it, it would give me an error saying im missing the parameter, right?

1 answer

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