Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't my Preloaded sound loaded?

Every once in a while, a strange phenomenon will happen where I play a Preloaded sound but nothing comes out of the speaker.

I use sound:Play() to start playing the sound. While debugging, I found that sound.IsPlaying is true, but sound.IsLoaded is false.

That explains why I'm not hearing anything, but earlier in the code I preloaded the sounds using this loop:

for _, v in pairs (SoundFolder:GetChildren()) do
	ContentProvider:Preload(v.SoundId)
end
while ContentProvider.RequestQueueSize > 0 do 
	wait();
end

This loop takes every sound object I stored on a client based folder and Preloads their sound into the system. It waits until their sound is loaded.

Why is this not working?

4 comments

0

Is this in script or localscript?

0

localscript

0

Are you trying to preload each asset in a table?

0

I pull the asset ID from each object, then I preload it. The objects are in a File Object which I am looping through

1 answer

I think the problem was that you had it in a local script, because I created a SoundFolder with a lot of sounds and created this script in the workspace:

local sf = workspace.SoundFolder:GetChildren()
for i,v in pairs(sf) do
game:GetService("ContentProvider"):Preload(v.SoundId)
print(v.SoundId)
end

And it worked fine as a server script. When I tested it in a LocalScript, it didn't print the assets nor load them. That might have been the issue. I hope this helped, If it did please accept my answer!

This discussion is preserved as it was. New answers, comments, and votes are closed.