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

How do I play random music?

Asked by 9 years ago

So I am wanting to make a script that plays a random id from a table. the table name is "local ids"

I need this for a shop im making..

1 answer

Log in to vote
0
Answered by
ItsMeKlc 235 Moderation Voter
9 years ago
local pre = {"268763467","261244793","142570249","165508381"} --Example songs
local whatpre = pre[math.random(1,#pre)]
music.SoundId =("http://www.roblox.com/asset/?id="..whatpre)
music:Play()


0
Would I be able to replace "music" with script.Parent or would that not work? ObscureIllusion 352 — 9y
0
It will work. UltraUnitMode 419 — 9y
Ad

Answer this question