So i made music system for my obby game but i need it to shuffle songs and i dont know how to do it since im am pretty much newbie in scripting help? here is the script:
local MarketPlaceService = game:GetService("MarketplaceService")
local Songs = { 5410082097, 4324837704, 3357763594
}
local SongObject = script.Parent.Song local SongLabel = script.Parent.SongLabel local SkipButton = script.Parent.SkipButton local MuteButton = script.Parent.MuteButton
MuteButton.MouseButton1Click:Connect(function() if SongObject.Volume == 0.25 then SongObject.Volume = 0 else SongObject.Volume = 0.25 end end)
SkipButton.MouseButton1Click:Connect(function() SongObject:Stop() end)
while true do for i = 1, #Songs do local Song = Songs[i] local SongInfo = MarketPlaceService:GetProductInfo(Song)
SongObject.SoundId = "rbxassetid://" .. Song SongObject:Play() SongLabel.Visible = true SongLabel.Text = SongInfo.Name repeat wait() until not SongObject.IsPlaying end
end
instead of local Song = Songs[i]
, do local Song = Songs[math.random(1,#Songs)]