Hello there,
I recently made a music player from my simulator.
I’m currently having some issues with it. After the song finishes, a new song is NOT chosen (it does not play at all!)
Here is my script:
local ContentProvider = game:GetService('ContentProvider')
local MusicIDs = {1843382633,1838058421,1842967125,1837871067,1842104602,1843384340,1847606521}
local PreviousSong
--ContentProvider:PreloadAsync({MusicIDs})
while true do
local ChosenSong
if #MusicIDs == 0 then
continue
end
if PreviousSong ~= nil then
while ChosenSong == PreviousSong do
print('looping')
wait(.5)
math.randomseed(tick() ^ 3 * (3/math.tan(math.random(3,100)) * math.abs(math.random(1,9))))
ChosenSong = MusicIDs[math.random(1,#MusicIDs)]
end
else
math.randomseed(tick() ^ 3 * (3/math.tan(math.random(3,100)) * math.abs(math.random(1,9))))
ChosenSong = MusicIDs[math.random(1,#MusicIDs)]
end
local Song = Instance.new('Sound')
Song.Name = 'CurrentSong'
Song.Parent = workspace
Song.SoundId = "rbxassetid://"..ChosenSong
Song:Play()
Song.Stopped:Wait()
PreviousSong = ChosenSong
wait(1)
Song:Destroy()
end
Does anybody know why this happens?