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