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

Why does this only loop in studio?(Unsolved)

Asked by 8 years ago

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
0
Are you sure the queue is ever changing? NoahWillCode 370 — 8y
0
It shouldnt need to if its blank shouldnt it? bubbaman73 143 — 8y
0
Ah true. Have a print statement after your two .Ended:wait()s to see if that is an issue. NoahWillCode 370 — 8y
0
Ahhhhh it doesnt print Ended bubbaman73 143 — 8y
View all comments (5 more)
0
But it DOES do it in studio.. bubbaman73 143 — 8y
0
It may be true, then, that the .Ended event is not working...I'd check the wiki. NoahWillCode 370 — 8y
0
idk, i dont see a reason why it wouldnt work unless i NEED the soundid in the parentheses bubbaman73 143 — 8y
0
but if i needed it, it would give me an error saying im missing the parameter, right? bubbaman73 143 — 8y

1 answer

Log in to vote
-1
Answered by
ZarceI 0
8 years ago

while true do wait(.1) end

0
Didnt work bubbaman73 143 — 8y
Ad

Answer this question