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

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…