Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
ImfaoXD 158
8 years ago

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

Log in to vote
0
Answered by 8 years ago

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.

0
Thanks! I'll give it a try. Thank you. This is my dream script!!! :D ImfaoXD 158 — 8y
Ad

Answer this question