I'm making a shuffle script (Play a random audio in the list), which doesn't work. Not only does the audio not play anymore (Does in studio, but the next song starts at halfway for some reason) but when i try and use wait(music.TimeLength) it goes crazy and won't work properly. So i used the ended function which brings me here. It only works in studio as i said, and even there not properly. I need it to work ingame + properly.
wait(0.1)
song1 = "http://www.roblox.com/asset/?id=348452202" -- Diplo & Sleepy Tom - Be Right There
song2 = "http://www.roblox.com/asset/?id=235672613" -- Years & Years - Desire
song3 = "http://www.roblox.com/asset/?id=335856846" -- Craig David - When the Bassline Drops
song4 = "http://www.roblox.com/asset/?id=258218642" -- Lean on
song5 = "http://www.roblox.com/asset/?id=348130053" -- Sigala - Say You Do
song6 = "http://www.roblox.com/asset/?id=366818956" -- DJ Snake - Middle
song7 = "http://www.roblox.com/asset/?id=341409912" -- 67 (Mental K, Dimzy, Monkey, Smallz)
song8 = "http://www.roblox.com/asset/?id=400165614" -- Mike Posner - I Took A Pill In Ibiza (Seeb Remix)
song9 = "http://www.roblox.com/asset/?id=342921010" -- Roses - The Chainsmokers ft. ROZES
song10 = "http://www.roblox.com/asset/?id=324474850" -- 99 Souls - The Girl is Mine
song11 = "http://www.roblox.com/asset/?id=397950586" -- Calvin Harris & Disciples - How Deep Is Your Love
song12 = "http://www.roblox.com/asset/?id=225214406" -- Lost Frequencies - Are you with me
song13 = "http://www.roblox.com/asset/?id=345686522" -- Flume (feat. Kai) - Never Be Like You
song14 = "http://www.roblox.com/asset/?id=239028897" -- GTA - Intoxicated
song15 = "http://www.roblox.com/asset/?id=208170888" -- Felix Jaehn - Ain't Nobody (Loves Me Better)
song16 = "http://www.roblox.com/asset/?id=398856245" -- Skepta - Man
song17 = "http://www.roblox.com/asset/?id=291846600" -- JME - Man Don't Care
song18 = "http://www.roblox.com/asset/?id=401722473" -- Blonde Ft. Craig David - Nothing Like This
song19 = "http://www.roblox.com/asset/?id=362353405" -- Robin Schulz - Sugar
song20 = "http://www.roblox.com/asset/?id=161499083" -- Disclosure - White noise
song21 = "http://www.roblox.com/asset/?id=236597881" -- Natalie La Rose ft. Jeremih (Somebody)
song22 = "http://www.roblox.com/asset/?id=325698676" -- Galantis - Runaway (U & I)
song23 = "http://www.roblox.com/asset/?id=409557291" -- 10/10 swagman woutman awesome wouter song
local music = Instance.new("Sound")
music.Archivable = true
music.Parent = script.Parent
music.Pitch = 1
music.Volume = 0.3
music.Looped = false
music.Name = "Player"
music.SoundId = "http://www.roblox.com/asset/?id=12222054"
music:play()
music.Ended:connect(function()
local songs = {song1,song2,song3,song4,song5,song6,song7,song8,song9,song10,song11,song12,song13,song14,song15,song16,song17,song18,song19,song20,song21,song22,song23}
local song = math.random(1,#songs)
local var = song
print("Playing Sound"..song)
--script.Off.Value = false
--script.Song.Value = "Song"..song
wait(0.01)
music.SoundId = songs[song]
music:play()
end)

1 comment
Thank you! It works :D