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

How to Pick random music?

Asked by 8 years ago

I want to pick random music but math.random didn't work is ther anyway to do this right now it's just a test

MUSIC01 = game.Workspace.AmbientMus01
MUSIC02 = game.Workspace.AmbientMus02
while wait() do
    math.random(MUSIC01, MUSIC02):Play()
end

1 answer

Log in to vote
0
Answered by
CodeNil 30
8 years ago
local Music = {game.Workspace.AmbientMus01, game.Workspace.AmbientMus02}

while wait() do
    local Current = Music[math.random(1, #Music)]
    Current:Play()
    wait(Current.TimeLength)
end

How i'd do it anyway, plenty of alternative solutions if you need them.

0
THank you :D arrowman888 69 — 8y
Ad

Answer this question