Ad
Log in to vote
0

Why does this only work in studio?

Asked by 1 year ago

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
0
Probably not related, but you're missing `Queue.S3.Value = Queue.S4.Value`. XAXA 825 — 1y
0
omg your right qq bubbaman73 145 — 1y

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
1
Answered by
Cuvette 222
1 year ago

This might help. https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online

1
Typically posts of this kind should be left in the comments section, however due your reputation you do not have that privilege. Note to the asker, this is a blog link not a question link. M39a9am3R 2817 — 1y
0
But im waiting for the sound though in line 9, why wont that work? bubbaman73 145 — 1y
Ad

Answer this question



Ad