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

Way to make a music randomize?

Asked by 5 years ago

The title is always confusing dumb me. Is there a way for me to make certain music playing occur like those secret tool audio or something. I can't find a way how to make a tool that has a chance of playing a hidden song.

script (this is what I've got):

lua Tool.dancepart.Position = player.Character.Head.Position Tool.dancepart.SongLoop.SoundId = "rbxassetid://" Tool.dancepart.SongLoop:Play()

0
Please ignore the lua, thought that will work in this question. TheBuliderMC 84 — 5y
0
also, all of the script is in a local script TheBuliderMC 84 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

Make a table and call it with math.random(1, how many songs you got)

0
I got about 2 songs. and one of them has a low chance of playing TheBuliderMC 84 — 5y
0
well just keep switching it with a while loop, that is how math works :P H_exadecimal 9 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

u can add weights on ur songs(say, song 1 has 37% chance of playing, song 2 has 63%, etc) and generate a number from 1 - 100. If the number lands within a specific margin(e.g, 1 - 37), u can play that song, else u can check if the number lands within another margin and play that song instead.

Answer this question