I have ran into an issue with audio and I'm wondering if there is any way around it. I want it so that whenever a song is finished playing another song will begin playing. The problem is that after one song runs, about 90% of the time a second song will not play. I am not quite sure why but I believe that the problem lies with .IsPlaying
. I read that it doesn't work and even when it does it still isn't working too well. Is there any way to deal with the audio problem without having the script just wait for the length of the song that is playing?
songs = {142401311, 163870179, 149761849} workspace.Music:Play() --this is one method that I read to fix it, it doesn't quite help wait(0.5) workspace.Music:Pause() wait(0.5) workspace.Music:Stop() while wait() do if workspace.Music.IsPlaying == false then selection = math.random(1, #songs) workspace.Music.SoundId = "http://www.roblox.com/asset/?ID="..songs[selection] if selection == 1 then workspace.Music.Pitch = .53 elseif selection == 2 then workspace.Music.Pitch = .75 elseif selection == 3 then workspace.Music.Pitch = .5 end workspace.Music:Play() end end
songs = {142401311, 163870179, 149761849} workspace.Music:Play() --this is one method that I read to fix it, it doesn't quite help wait(0.5) workspace.Music:Pause() wait(0.5) workspace.Music:Stop() function Pitch() -- Methods help you at all moments! ;) selection = math.random(1, #songs) workspace.Music.SoundId = "http://www.roblox.com/asset/?ID="..songs[selection] if selection == 1 then workspace.Music.Pitch = .53 elseif selection == 2 then workspace.Music.Pitch = .75 elseif selection == 3 then workspace.Music.Pitch = .5 end end while true do if workspace.Music.IsPlaying == false then Pitch() workspace.Music:Play() -- What i noticed is that you don't have a pause and you have a If statement blocking because it only works if IsPlaying... When the song stops it doesn't run. --Logical problems :/ elseif workspace.Music.IsPaused == true then -- Alternate method Pitch() workspace.Music:Play() end --wait(workspace.Music.TimeLength * 1000) -- Until song ends wait(120) end
Hope this helps! If not tell output! ~marcoantoniosantos3