Hey, my nephew has made this Music Player script, yet it doesn't work. It's supposed to play one song, then when that finishes, it plays the next, and just keeps going, then loops back to the first one etc.
The errors in the console are things like this; ContentProvider:PreloadAsync() failed for rbxassetid://413625451
But the ID is different each time, and it prints them really fast.
I have no idea how to fix this, here is my code;
local cp = game:GetService('ContentProvider') local assets = { 'rbxassetid://413625451', 'rbxassetid://142281425', 'rbxassetid://986301757', 'rbxassetid://327081386', 'rbxassetid://243372213', 'rbxassetid://887339742', 'rbxassetid://877806338', 'rbxassetid://697236118', 'rbxassetid://229990159', 'rbxassetid://333302122', 'rbxassetid://765968440', 'rbxassetid://430028323', 'rbxassetid://972103544', 'rbxassetid://931034724', 'rbxassetid://869684560', } cp:PreloadAsync(assets) local music = Instance.new("Sound") music.Archivable = true music.Parent = script.Parent music.Looped = true music.Pitch = 1 music.Volume = 1 music.Name = "Music" for i = 1, #assets do music.SoundId = i music:Play() end
EDIT: I would recommend getting rid of the strings in your table and only putting the id numbers so you can use this (to be honest I don't know if you have to replace the strings with the id numbers):
local ContentProvider = Game:GetService("ContentProvider") -- load a bunch of assets local assets = {2253543, 2434541, 5133543, 2423433} --replace with your assets ids ContentProvider:PreloadAsync(assets) -- wait for them to complete while ContentProvider.RequestQueueSize > 0 do wait(0.1) end
basically stolen from wiki, modified to not use deprecated functions
More info: http://wiki.roblox.com/index.php?title=API:Class/ContentProvider