PreloadAsync stops at players for some reason

This might be a roblox bug but everytime I play my game the loading screen works but when its loading it gets stuck at one point making it unplayable. When I play on roblox studio it works.

In-Game

Script:

for i=1,#Assets do
	local asset = Assets[i]
	ContentProvider:PreloadAsync({asset})
	script.Parent.LoadingText.Text = string.upper(tostring(asset))
	script.Parent.Assets.Text = i.."/"..#Assets
end

1 Like

Uhhh, we could try wrapping the async and also, if this reply doesn’t work, send your full code. I’d like to see what ‘Assets’ is.

Attempt

for i=1,#Assets do
	local asset = Assets[i]
	coroutine.wrap(function()
		ContentProvider:PreloadAsync({asset})
		script.Parent.LoadingText.Text = string.upper(tostring(asset))
		script.Parent.Assets.Text = i.."/"..#Assets
	end)()
end

What’s in your assets table? I’ve got a suspicion that might be the issue.

1 Like

Or you could try:

for _, Asset in ipairs(Assets) do
    ContentProvider:PreloadAsync({Asset})
    script.Parent.LoadingText.Text = string.upper(Asset.Name)
    script.Parent.Assets.Text = Asset .. "/" .. #Assets
end

This is exactly what is happening to me. Loads perfectly fine on Studio but not when I publish it, it gets stuck at one point and makes the game unplayable. This should really be looked by the staff…

2 Likes

add a repeat task.wait() until game:IsLoaded()at the top of this script

This issue has been happening for me as well, have you found the solution?

Happened to me as well, I have tried many times till figured it stucks when it finds Animation with ID that the place can’t load (Animation that i owned in other group but not in the actual group of the place.
So just make sure all of the ID’s of the assets you preloading are correct and that your place has access to them.

2 Likes