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

How can my script randomly select songs?

I'm making a script for a club so it plays music but how can I make it choose random songs?

Songs = {"401120618","467369212","399781334","461984143"} 
Sound = Instance.new("Sound",workspace)
	wait(0.1)
	SoundID = (Songs)
	Sound.SoundId = "http://www.roblox.com/asset?id="..SoundID
	Sound:Play()
	wait(115)
	Sound:Stop()

2 answers

✓ Accepted answer

Script

local Songs = {"401120618","467369212","399781334","461984143"}  -- Use local variables
local Sound = Instance.new("Sound",workspace)
wait(0.1)
while true do
	local SoundID = Songs[math.random(1, #Songs)]
	Sound.SoundId = "http://www.roblox.com/asset?id="..SoundID
	Sound:Play()
	wait(Sound.TimeLength)
	Sound:Stop()
end
local songs = {"401120618","467369212","399781334","461984143"}

	local sound = Instance.new("Sound")
	local randmusic = math.random(1,#songs)
	sound.Parent = game.Workspace
	sound.SoundId = "http://www.roblox.com/asset/?id="..songs[randmusic]
	sound:Play()

If this is what you wanted, please vote this up and accept this as an answer. I hope this helped you :)

2 comments

0

Nope, it did not changed songs it played one song and did not play another ):

1

You never asked for that tho :/

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