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

Music Radio not working with new song when finished?

I am trying to make multiple IDs play after another, but it won't play another ID after this stops. What'd I do wrong?

while wait() do
	for _,List in pairs(JSON) do
		Music.SoundId = "http://www.roblox.com/asset/?id="..tonumber(List.desc)
		script.SongName.Value = tostring(List.name)
		Music:Play()
		wait(1)
		repeat wait() until not Music.IsPlaying
		wait(1)
	end
end

4 comments

0

In Goulstem's code, input this in between line 5 and 6: "repeat wait() until Music.TimeLength > 0"

0

Still didn't work.

0

I meant lines 4 and 5.

0

Still doesn't work.

2 answers

✓ Accepted answer

Well, sometimes the TimeLength and IsPlaying both break. If that's the case, I recommend you manually time the sound yourself. In that table of yours, add another parameter with the length of the sound, and have it wait that length. That's the other option, if the above to methods fail.

Your Problem

You actually didn't do anything wrong. The IsPlaying Property on the roblox sound object is broken, and has been neglected a fix for awhile now. It doesn't change when the sound is done, or starts. It stays idle forever.

You need to use the wait function, with arguments of Music.TimeLength


Code

while wait() do
	for _,List in pairs(JSON) do
		Music.SoundId = "rbxassetid://"..tonumber(List.desc)
		script.SongName.Value = tostring(List.name)
		Music:Play()
		wait(Music.TimeLength)
	end
end

4 comments

0

The thing is, I did that, and then it just spammed all of the songs stop play stop play.

0

It shouldn't. I just replicated this in my studio and it worked perfectly.

0

Still spams.

0

http://prntscr.com/7hu8z3 < "print(Music.TimeLength)"

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