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

Way to make a music randomize?

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):

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

2 comments

0

Please ignore the lua, thought that will work in this question.

0

also, all of the script is in a local script

2 answers

✓ Accepted answer

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

2 comments

0

I got about 2 songs. and one of them has a low chance of playing

0

well just keep switching it with a while loop, that is how math works :P

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.

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