I've been trying to load my sounds using PreloadAsync, but sometimes when I join my place, the sounds just fail to load and they never play(even if I stay for half an hour). I have to keep rejoining the place until all the sounds load correctly.
I do have a very slow computer and I thought that might be the issue, but i've played some very polished games like Hexaria, and even though the sounds in Hexaria can sometimes take a couple minutes to load for me, they still load every single time without me having to rejoin.
Heres what i've been using to try and load in my sounds.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ContentProvider = game:GetService("ContentProvider") local SFX = ReplicatedStorage:WaitForChild("Everything"):WaitForChild("SFX") local Assets = SFX:GetChildren() -- Load all sound assets. ContentProvider:PreloadAsync(Assets) ------------------------------------------------------------------
I put all the sounds assets in one folder called "SFX"(which is inside of a folder called "Everything"), and i'm inserting them into the Assets table. Then I try to load all the assets in the table using the ContentProvider service, but that just doesn't seem to work 100% of the time.
I've also just tried to wait for all the children inside of the "SFX" folder using the code below.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ContentProvider = game:GetService("ContentProvider") local SFX = ReplicatedStorage:WaitForChild("Everything"):WaitForChild("SFX") local Assets = SFX:GetChildren() -- Load all sound assets. for i, v in pairs(SFX:GetChildren()) do SFX:WaitForChild(v.Name) -- Am I doing this wrong? end ContentProvider:PreloadAsync(Assets) ------------------------------------------------------------------
This unfortunately didn't work for me either after some testing.
What is the best way to make sure all the sounds load?