I don’t think I can get away with WaitForChild when it comes to sounds.
So I have a folder and eventually a folder with subfolders that will contain descendant sounds throughout, and I want to know, be assured, that the sounds are loaded in when they are about to be used.
How do I wait for a sound loaded en masse? Should I just connect events to every single sound for its loaded state entry event and then hook a counter up that lets the rest of the script continue once the number equals the number of sounds?
local ContentProvider = game:GetService("ContentProvider")
ContentProvider:PreloadAsync({Sound.SoundId},nil) --no process error function
--rest of code yeilding to
The above code is just failing to load, and, testing in Studio the sound does indeed load afterwards. It is called Preload, but it does not appear to prioritize load. On the wiki it almost seems as if it just gives you an event to connect to for when something failed to load for that very moment. Correct me if I’m wrong.
Thanks for the link, but note that my question concerned multiple sounds, and not a single sound like your first solution, for which case is not scalable.
Consider looking into a useful function of RBXScriptSignals called Wait()
You could iterate over each sound, creating one and setting them to each ID until they have loaded
If you’re wondering how you’d achieve this: Sound.Loaded:Wait()
This will yield the code until the Loaded event is fired.
Is this not related to the gross nature of a general wait()? I have intentionally stayed away from these because of the mental association of playing laggy games that use wait(time).