Preload (Function)

From Goodblox Wiki
Jump to navigationJump to search
Function
Syntax Preload( Content content )
Returns n/a
Description: Downloads the requested asset to the client and prepares it for use. Should be used in a LocalScript.
In Object: ContentProvider


Example

Can be used to load an asset (common assets loaded are images) so it doesn't take any time when shown as textures or decals.

game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=2453543")

Example

A fast way to load assets is to put them into a table, then loop through the table, and load them.

local assets = {2253543, 2434541, 5133543, 2423433, 41143243, 2453865, 21433365, 2154549}
local contentProvider = game:GetService("ContentProvider")

for i = 1, #assets do
     contentProvider:Preload("http://www.roblox.com/asset/?id="..assets[i])
end