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

[FIXED] Random Music script will not work Sound will not play?

Asked by 7 years ago
Edited 7 years ago

So, I am trying to make a random music script and after a few tweaks it seems to randomize, however it is not playing afterwards and I could not think of why this is happening and i'm very confused. Help would be greatly appreciated <3 also it is a Script not a local script

while true do
    wait()
    if game.Workspace.mus1.IsPlaying == true then

    else
        ID = math.random(1,3)
        if ID == 1 then 
            game.Workspace.MusicID.Value = 303226835
            end

        if ID == 2 then
            game.Workspace.MusicID.Value = 504618717
        end


        if ID == 3 then
            game.Workspace.MusicID.Value = 411822352


        end 
        workspace.mus1.SoundId = workspace.MusicID.Value
        wait(1)
        script.Parent:Play()
    end 
    end



0
"== true then else", why not use "== false then" RubenKan 3615 — 7y
0
Why not use a table containing all your sound Id's and use SoundId = table[math.random(1,#table)]? Also you could use the Song.Ended event to start the next song rather than using an endless loop. AZDev 590 — 7y
0
If you'd like I could write up an example. AZDev 590 — 7y
0
Please, if it does not bother you ! :D Karl_RBX 11 — 7y

Answer this question