I want to achieve a working playlist script, the issue is that it stops playing after the second time.
Server script:
local MusicTable = {
id1,id2,id3,etc
}
local MPS = game:GetService("MarketplaceService")
local Music = game.Workspace.Folder:WaitForChild("Music")
local OnPlayBoolean = true
while not Music.IsPlaying do
if OnPlayBoolean then
OnPlayBoolean = false
local RandomMusic = MusicTable[math.random(#MusicTable)]
Music.SoundId = "rbxassetid://"..RandomMusic
Music:Play()
if Music.Ended then
print(MPS:GetProductInfo(RandomMusic).Name.." has started playing.")
end
Music.Ended:Wait()
OnPlayBoolean = true
end
end
Please ignore:
if Music.Ended then
print(MPS:GetProductInfo(RandomMusic).Name.." has started playing.")
end