Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Pick random music?

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

✓ Accepted answer
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.

1 comment

0

THank you :D

This discussion is preserved as it was. New answers, comments, and votes are closed.