Why is contentprovider not preloading the sounds?

Hello im trying to preload the sound but it shows to be not working

local contentprovider = game:GetService("ContentProvider")

for _, v in pairs(game.ReplicatedStorage:WaitForChild("Background Music").BackgroundMusicZones:GetDescendants()) do
    if v:IsA("Sound") then
        contentprovider:PreloadAsync({v})
        print(contentprovider.RequestQueueSize)
    end
end
1 Like

Content provider only preloads images not sounds.

It does? It’s very specified on the ContentProvider API That it loads Decals and Sounds.

Plus, Replying to OP (@simply_kiel), Are you Preloading the sounds on the Client or Server? And are you loading them instantly or after a certain time?

1 Like

PreloadAsync automatically catches descendants, consider not passing each descendant individually and just pass the main container with all the music instead. As for why it’s not preloading sounds, the only guess I can wager here has already been said; make sure this is done from a LocalScript.

Timing shouldn’t matter. PreloadAsync just marks any content ids in an instance and its given descendants to be moved to the front of the download queue (and if they aren’t already being streamed in in the background, then added to the queue at the front).

2 Likes

Yeah. My guess is that if you have only a couple of asset like maybe a couple hundred they should load pretty quickly.

like 0.0001ms not rly lol

Really should be used if you use a lot of meshes, very long sound tracks or a ton of images.

Depending on your internet and the speed of your device the loading of assets for your device may be too quick for you to measure. If you want my guess try using a slow device.

1 Like

Server, yes im loading them instantly

nevermind! its just the musics got copyrighted lol and being offsale

Hey there just wanted to let you know that there is a callback function you can put into ContentProvider. Just remembered. It works like this:

local clock = os.clock()
ContentProvider:PreloadAsync(
	{game},
	function(asset: string,assetFetchStatus: Enum.AssetFetchStatus)
		print("Loading:",asset)
		print("Status:",assetFetchStatus.Name)
	end
)
print(("Preloading complete, took %.2f seconds"):format(os.clock() - clock))

1 Like