Hi there,
Just recently I've made a script that will play songs from a pre-defined playlist. It'll loop trough the playlist and will prioritize songs added by players who purchased a one-time custom song.
The script will play the first song on the playlist just fine. A player joins the game, music starts, all good. The moment I stop the song using Sound:Stop(), the script will play the next song instantly. However, the "Playing" value on the Sound is only checked on for the Server, and not the Client (?). I have no clue why/how, and I'm truly lost.
Any help would be much appreciated!
local SoundService = game:GetService("SoundService")
--/ Variables
local CurrentSong = 0
local SoundQueue = {}
--/ Functions
local function ContinuePlaylist()
--/ Check queue for purchased songs first
if #SoundQueue >= 1 then
--/ Song in queue
else
--/ Play from playlist
CurrentSong += 1
for _, Sound in pairs (SoundStorage:GetChildren()) do
if not Sound.IsPlaying then
local PlaylistPosition = Sound:GetAttribute("PlaylistPosition")
if PlaylistPosition == CurrentSong then
Sound:Play()
Sound.Stopped:Connect(function()
ContinuePlaylist()
end)
end
end
end
end
end
--/ Startup
ContinuePlaylist()
