Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Music Radio not working with new song when finished?

Asked by 9 years ago

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
0
In Goulstem's code, input this in between line 5 and 6: "repeat wait() until Music.TimeLength > 0" Redbullusa 1580 — 9y
0
Still didn't work. TypicalModerator 110 — 9y
0
I meant lines 4 and 5. Redbullusa 1580 — 9y
0
Still doesn't work. TypicalModerator 110 — 9y

2 answers

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

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.

Ad
Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

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

0
The thing is, I did that, and then it just spammed all of the songs stop play stop play. TypicalModerator 110 — 9y
0
It shouldn't. I just replicated this in my studio and it worked perfectly. Goulstem 8144 — 9y
0
Still spams. TypicalModerator 110 — 9y
0
http://prntscr.com/7hu8z3 < "print(Music.TimeLength)" TypicalModerator 110 — 9y

Answer this question