AssetFetchStatus.Failure,IsLoaded false for successfully loaded audio

-- i run a rhythm game and it’s absolutely necessary that I make sure audio is properly preloaded beforehand, but lately a random issue has been popping up where some players haven’t been able to preload lately. the music still plays in spectator mode for them, so the audio is clearly being loaded, but IsLoaded is never getting set to true and when preloading it keeps passing AssetFetchStatus.Failure. i’m not sure if this is the appropriate place but this is also a major issue for my game and I can’t access bug reports. is there any way to work around this at this point?

-- here’s the preloading code, this worked perfectly fine for two years and still works perfectly fine for most players, but for some they can’t load songs ever now. (and yes, music is an instance, not an assetid)

local complete = false
local success = false
contentProvider:PreloadAsync({ music }, function (asset, status)
	print(status)
	if status == Enum.AssetFetchStatus.Success then
		success = true
	else
		for i = 1, 10 do
			if music.IsLoaded then
				success = true
				break
			end
			task.wait(1)
		end
	end
	complete = true
end)

-- this is also absolutely an issue with roblox but i can’t report bugs so, i’m kind of just stuck dealing with people complaining about an issue that makes absolutely no sense

-- bump 'cause this is still happening, i’d like to be able to consistently tell if audio has successfully loaded again

– this is STILL an issue. it’s a per-client thing so it’s very hard to replicate but I’ve finally found a recording of this issue occuring. the notification in the bottom right corner appears if IsLoaded is set to false, but then the song plays instantly with no delay showing that it literally is loaded. can i get any response on this? https://youtu.be/xtyjBfT3Vqs?si=wlScb4o7N2RKu13o&t=75

-- bump AGAIN, because this STILL is happening after ANOTHER update

I’m not exactly sure if my post below will help you or that you’ve already tried this.

From what you said IsLoaded boolean and the :PreloadAsync() status are unreliable. I know that you’ve stated in that title it returns Failure, but maybe try :GetAssetFetchStatus() as a last resort for the success boolean. Heres an example:

local complete = false
local success = false
contentProvider:PreloadAsync({ music }, function (asset, status)
	print(status)
	if status == Enum.AssetFetchStatus.Success then
		success = true
	else
		for i = 1, 10 do
			if music.IsLoaded then
				success = true
				break
			end
			task.wait(1)
		end
	end
	complete = true
end)
-- ... (however you handle waiting until complete is true)
if success == false then success = (contentProvider:GetAssetFetchStatus(music.SoundId) == Enum.AssetFetchStatus.Success) end

I can see something happening with this code that might be causing the complete and success locals to not be set to true in time.

I’m not sure how the PreloadAsync function runs under the hood, but it’s possible it stops yielding before it runs the last given callback function. So, for example, code you have directly after the PreloadAsync call will run before the callback you provided in the function.

If I were you, I’d instead add an event or somehow handle the code you need inside the callback so at least you’re sure the value stays the same.

Could you explain why you need to know if IsLoaded is true? Are you delaying a round to start until the sound loads to be safe?

-- the game is a rhythm game, i need to wait for the music to be loaded as that is a core part of the gameplay. i need to see that isLoaded is true because if the audio failed to load, i need to end the gameplay and show the user a warning that the audio failed to load. nothing runs immediately after PreloadAsync is run

Could you be more specific about this?

You mean for specific players they rejoin and it keeps failing to load? In that case, this sounds basically like an issue with Roblox’s way of loading and caching assets in games.

Does this issue occur very often, as in >10% of the time? If it’s rarer than that, then it’s probably nothing unusual in Roblox terms, PreloadAsync isn’t the most reliable.

1 Like

-- “failed to load” was poor wording, sorry. the game used to end early with a warning message to the player if it saw that the audio “failed” to load, i had to go back and remove that behavior and replace it with the warning message that shows up in the video i linked earlier in this thread. it’s not that audio is failing to load, it’s that it’s reporting that its failed to load, and if i check “IsLoaded” it will also return false, even while the audio is already playing

-- this issue never, ever occurred until a few days before posting this issue. this issue will affect random players, across multiple platforms. affected players will always get the error that the music failed to load for every single song, regardless of if they restart their game or device, and the issue will last for days or weeks before randomly disappearing. it’s so unpredictable and unreproducible and, again, was never a problem until very recently

I tested with my game by printing the assetid and status of preloads of quite a few items, and they all returned Successful except for Instances that didn’t have an assetid tied to them. Could you check if everything you’re preloading already has the assetid in it before you checked for preloading?

My final advice: Keep trying to load audios, but ignore the failure to load if it returns false and attempt to play the audio anyway.

If you use PreloadAsync and check the IsLoaded value on the server, then switch the code to the client as these functions are only really relevant when ran on the client either way.

A UX tip to at least make things appear better for players:

You could, instead of showing a warning message that the audio may have failed to load, add a button (only when it fails) in the corner of the screen titled “Audio not playing?” that cancels the game which is hopefully better user experience.


-- as i said, this issue is a per-player thing–it’s unreproducible. it just happens at random with random players, and any player that’s affected by the glitch will always be affected by the glitch

-- i already do ignore the warning message when an audio fails to load, as i have to so that players don’t get permanently locked out of my game, but it overcomplicates things to no end

-- also this code is only run client-side, not server-side

After a while of just letting my own game keep running, I can say no players have encountered any issue with the initial loading screen, so I can’t exactly reproduce this issue.

If I were you in this scenario, I’d start double-checking every step of the process including where you set your AssetId strings, where the sounds are, whether the sounds are preloaded before the AssetId property is even replicated, things like that. Otherwise, let your game keep running and hopefully it’s a Roblox-side issue that resolves itself eventually.

-- sounds are created clientside, so it wouldn’t be a replication issue. it is definitely a roblox-side issue, but its been around for months now and i can’t report a bug so the next best thing i can do is post here

You’re not alone @skedgyedgy. This issue has been plaguing us for months. Finally raised a bug report today: IsLoaded is intermittently returning False for successfully loaded audio

-- TYSM! i hate not being able to post engine bugs myself

1 Like