It works fine in studio, just not ingame. How can I fix this, what is wrong?
wait(0.1) local songIds = {348452202, 235672613, 335856846, 258218642, 348130053, 366818956, 341409912, 400165614,342921010,324474850,397950586,225214406, 345686522, 39028897, 208170888, 398856245, 291846600, 401722473, 362353405, 161499083, 236597881, 325698676, 409557291} --[[ 348452202 -- Diplo & Sleepy Tom - Be Right There 235672613 -- Years & Years - Desire 335856846 -- Craig David - When the Bassline Drops 258218642 -- Lean on 348130053 -- Sigala - Say You Do 366818956 -- DJ Snake - Middle 341409912 -- 67 (Mental K, Dimzy, Monkey, Smallz) 400165614 -- Mike Posner - I Took A Pill In Ibiza (Seeb Remix) 342921010 -- Roses - The Chainsmokers ft. ROZES 324474850 -- 99 Souls - The Girl is Mine 397950586 -- Calvin Harris & Disciples - How Deep Is Your Love 225214406 -- Lost Frequencies - Are you with me 345686522 -- Flume (feat. Kai) - Never Be Like You 239028897 -- GTA - Intoxicated 208170888 -- Felix Jaehn - Ain't Nobody (Loves Me Better) 398856245 -- Skepta - Man 291846600 -- JME - Man Don't Care 401722473 -- Blonde Ft. Craig David - Nothing Like This 362353405 -- Robin Schulz - Sugar 161499083 -- Disclosure - White noise 236597881 -- Natalie La Rose ft. Jeremih (Somebody) 325698676 -- Galantis - Runaway (U & I) 409557291 -- Wouter van Leeuwen - Discipline --]] local music = Instance.new("Sound") music.Archivable = true music.Parent = script.Parent music.Pitch = 1 music.Volume = 0 music.Looped = false music.Name = "Player" music.SoundId = "http://www.roblox.com/asset/?id=12222054" music:play() music.TimePosition = 0.1789999999999999 music.Ended:connect(function() music.Volume = 0.3 local song = math.random(1,#songIds) local var = song print("Playing Sound"..song) --script.Off.Value = false --script.Song.Value = "Song"..song wait(0.01) music.SoundId = "http://www.roblox.com/asset/?id="..songIds[song] music:play() end)
hey, just registered to help! your issue is "music.Ended". This event doesn't fire on the server for whatever lazy reason..
The only alternative (as far as i'm aware) is to store the length of each audio in an array (or whatever) and wait that long after starting before stopping the song and playing the next.