local sounds = {"158485547","157026036","158526174"} local audio = workspace:WaitForChild("Music").Sound local song = sounds[math.random(1,#sounds)] local playing = false audio.SoundId = "rbxassetid://"..song local currentsong = song while wait(1) do if playing == false then playing = true audio:Play() audio.Ended:Wait() song = nil song = sounds[math.random(1,#sounds)] if song == currentsong then song = nil song = sounds[math.random(1,#sounds)] end audio.SoundId = "rbxassetid://"..song audio:Play() playing = false end end
For example, if the song is the 1st argument of the table, it will stay like that forever. It doesn't pick another random sound?
local sounds = {sound1, sound2, sound3, sound4, sound5} -- replace with your id's local r = Random.new() function pickRandomSound() local randomIndex = r:NextInteger(1, #sounds) return sounds[randomIndex] end