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

How to pre-load an image? ( Easy ) Simple solution?

Ok so I will make a Tv in my game and images will change on it, but I noticed when the images change they take like 0.1 seconds to appear because the image isn't loaded.

wait(5)
script.Parent.Decal.Texture = "rbxassetid://73737626"

Then I tried doing this, but still, the image took some time to appear.

local image = "rbxassetid://73737626"
wait(5)
script.Parent.Decal.Texture = image

And when the images constantly change I don't want 0.1 seconds of a blank white screen before another image appears.

1 comment

0

Try this https://www.roblox.com/games/1689414409/80-Off-VIP-Roblox-Uno at the start when all the cards show up, he's preloading them

2 answers

✓ Accepted answer

You have to use the ContentProvider service. The :PreloadAsync function will preload the image. Note that the image has to be an instance which is inside a table in the script.

local ContentProvider = game:GetService("ContentProvider")

local image = {script.Parent.Decal}

ContentProvider:PreloadAsync(image)

wait(5)

script.Parent.Decal.Texture = image[1]

5 comments

0

How do I add multiple Images?

0

Just add them to the table variable called image.

0

Thank you, this worked perfectly and I learned something very useful from this!

0

No problem.

I think there is a property called Transparency. You could set multiple image and set it to 1

wait(5)
script.Parent.Decal.Texture.Transparency = 0 -- The image will be visible but you will need to set other image transparency to 1

Way 2 if the first one isn't possible You could make a folder containing many decal then every 5 second you put it on tv

wait(5)
local Pic = folder.Pic1 -- Change this
Pic.Parent = script.Parent

1 comment

0

Okay I will try that soon.

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