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

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

Asked by
14dark14 167
4 years ago

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.

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 Spjureeedd 385 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

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]

0
How do I add multiple Images? 14dark14 167 — 4y
0
Just add them to the table variable called image. youtubemasterWOW 2741 — 4y
0
Thank you, this worked perfectly and I learned something very useful from this! 14dark14 167 — 4y
0
No problem. youtubemasterWOW 2741 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
0
Okay I will try that soon. 14dark14 167 — 4y

Answer this question