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

Where Do I Put The API:Class/ContentProvider/Preload?

My decals take forever to load so I used this script but I don't know where to put it. If I want to make my decals load faster, do I put this script in "StarterGUI" or in "WorkSpace" Please help...

Here's a link to where I got this script:

http://wiki.roblox.com/index.php?title=API:Class/ContentProvider/Preload

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({2253543, 2434541, 5133543, 2423433, 41143243, 2453865, 21433365, 2154549})

1 answer

✓ Accepted answer

This would go in the ReplicatedFirst as a localscript. This is commonly included with a load screen Custom_loading_screen and includes ContentProvider RequestQueueSize to check that the game has loaded.

Once the RequestQueueSize is 0 then you know that the assets have been cached so that when they are needed there will not no lag when using the asset.

1 comment

0

Thanks! I'll give it a try. Thank you. This is my dream script!!! :D

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