Preloading images and keeping them loaded!

Preloading images and keeping them loaded!

Are you tired of your game not having assets loaded when entering a new scene? Is PreloadAsync not keeping the textures loaded? I found myself in this situation so I’m making this tutorial to help others.

Step One

Make a list of all the Asset IDs you want to load. This will be used to create the ImageLabels that forceload the assets.

local assets = {

Step Two

Create a ScreenGui in the local player’s PlayerGui that does not reset on spawn. You should also set IgnoreGuiInset to true

local preloadFrame ="ScreenGui")
preloadFrame.ResetOnSpawn = false
preloadFrame.IgnoreGuiInset = true
preloadFrame.Parent = game.Players.LocalPlayer.PlayerGui

Step Three

Make a function that goes through a list and creates a 1x1 image label that has 100% background transparency and 90% image transparency based on Asset IDs in the table. This is our main function, it is what forces the images to load and stay loaded.

local function makePreloadFrame(list)
    for i,v in pairs(list) do
        local new ="ImageLabel")
        new.Image = image
        new.Position = UDim2.fromOffset(i,0)
        new.Size = UDim2.fromOffset(1,1)
        new.BackgroundTransparency = 1
        new.ImageTransparency = 0.9
        new.Parent = preloadFrame

Step 4

Run makePreloadFrame() on the asset table


Step 5

Call ContentProvider:PreloadAsync() on the image labels we creates


Since the images are technically visible they are never unloaded but they are basically invisible. Note that doing this can significantly increase your memory usage depending on the amount of images you have.

1 Like