I've been having an issue where my background music in my game fails with the error Sound failed to load in, file not found
How does one fix this?
The script I'm using for it:
sound = Instance.new("Sound", game.SoundService)
sound.Name = "Background"
ids = {344852871 ,177081124 , 230210363, 963703151, 222354401, 444071223, 530579604, 166465461, 156469449}
local Audio = "rbxassetid://" .. ids[math.random(1,#ids)]
local ContentProvider = game:GetService("ContentProvider")
print(Audio)
ContentProvider:Preload(Audio)
sound.SoundId = Audio
sound:Play()
sound.Ended:connect(function()
local Audio = "rbxassetid://" .. ids[math.random(1,#ids)]
local ContentProvider = game:GetService("ContentProvider")
print(Audio)
ContentProvider:Preload(Audio)
sound.SoundId = Audio
sound:Play()
end)

3 comments
This always happens, there is no fix for it, even if you use a pcall.
https://scriptinghelpers.org/questions/47472/content-provider-not-preloading-sounds
^that has an answer that explains