I want a script so that whenever i press a button my my boombox it plays a random song out of the list Here is the script...

local songs = {184745270}
local ransong = 0
script.Parent.ClickDetector.MouseClick:connect(function()
	ransong =  math.random(1,#songs)
	script.Parent.Parent.MusicPart.Music.SoundId = ("http://www.roblox.com/asset/?id="..ransong)
	script.Parent.Parent.MusicPart.Music:Play()
end)

4 comments

0

This doesnt work for some reason can you help me?

0

You only have a single ID in the list...

0

Im adding more later on xD

0

Well if you're trying to play a random song but have only a single song, obviously the song will not be random.