Mostly even after the game loads every sound, sometimes it still won’t play as intended. I tried to make but it just checks it once and goes to another one either way.
I was trying to achieve like if the Asset preload ends up in Failure then repeat it again but either am dumb or I just can’t make it work
local function check()
local succ, err = pcall(function()
cp:PreloadAsync({loadables2[i]}, getStatus)
end)
if succ then
return true
else
return false
end
end
repeat wait() check()
until check() == true
print("yes")
amount_loaded = amount_loaded + 1
amountofassets += 1
itemtoload = loadables2[i]
coroutine.resume(thread)
If what you were hoping was to retry when PreloadAsync fails, then wrong idea because PreloadAsync generally never fails. Assets failing to load does not cause PreloadAsync to fail so it’s best that you take advantage of the callback to determine what the AssetFetchStatus of the current asset is. That being said, I have no idea what getStatus is doing (like if you’re trying to force fail the call or something).
For sounds, I personally double up by using a Sound’s Loaded event and IsLoaded property. I don’t trust ContentProvider alone so I double up by ensuring the sound is actually downloaded and ready for playback before playing the sound.