Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is there still a gray frame after preloading decals?

Here is my script for preloading a bunch of assets:

local ContentProvider = game:GetService("ContentProvider")

local function LoadAssets(AssetList)
	-- Takes an asset list and preloads it. Will not wait for them to load. 
 
	for _, AssetId in pairs(AssetList) do
		ContentProvider:Preload("http://www.roblox.com/asset/?id=" .. AssetId)
	end
end

LoadAssets({306913868,306913878,306913893,306913917,306913938,306913960,306913987,306914028,306914059,306914087,306914112,306914130,306914146,306914168,306914182,306914209,306914230,306914249,306914258,306914271,306914283,306914295,306914310,306914322,306914347,306914366,306914384,306914408,306914444,306914463,306914494,306914547,306914573,306914608,306914634,306914662,306914680,306914686,306914769,306914833,306914872,306914910,306914942,306914987,306915041,306915077,306915117,306915197,306915235,306915267,306915279,306915304,306915344,306915365,306915380,306915404,306915420,306915441,306915458,306915471,306915486,306915500})

local function WaitForAssetsToLoad()
	-- Yields until all requested assets are loaded.
 
	while (ContentProvider.RequestQueueSize > 0) do
		wait()
	end
end

WaitForAssetsToLoad()

Here is what the output is:

https://i.gyazo.com/08e3e14a48ae296e9b7cebec40616ee6.gif

Basically, each decal holds 100 frames, and has a X and Y Size Scale of 10. Then my script changes the X and Y Position Scale accordingly.

You may notice the gray frames when a decal is loading. Preloading helped decrease the decal loading time, but I'm not sure why there is still decal loading time.

1 answer

All you have to do is put everything in one function, like so:

function loadassets(rQueue)
	cp:Preload("http://www.roblox.com/asset/?id="..rQueue)
	while cp.RequestQueueSize > 0 do
		wait()
	end
end

loadassets(306913868,306913878,306913893,306913917,306913938,306913960,3069139)

That makes your code more efficient and it should hopefully fix your problem.

2 comments

0

Didn't fix the problem, but thanks.

0

I'm sorry I couldn't fix your problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.