but how do i make it so images get PRELOADED?
heres my preload script.
-- // Variables
local ContentProvider = game:GetService("ContentProvider")
local DayID = "rbxassetid://10489671462"
local DuskID = "rbxassetid://10489671574"
local NightID = "rbxassetid://10489671353"
local Day = script.Parent.Day.ImageButton
Day.Image = DayID
local Dusk = script.Parent.Dusk.ImageButton
Dusk.Image = DuskID
local Night = script.Parent.Night.ImageButton
Night.Image = NightID
local assets = { Day, Dusk, Night }
ContentProvider:PreloadAsync(assets)
print("Assets loaded.")
I might be wrong however, I think you need to use a LocalScript to preload the content (correct me if Iâm wrong) and the way I would go about it is just like this:
-- services
local contentProvider = game:GetService("ContentProvider")
-- variables
local assets = {
"rbsassetid://0",
"rbsassetid://1",
"rbsassetid://2",
}
-- functions
contentProvider:PreloadAsync(assets)
That way nothing yields in between the PreloadAsync function
When preloading a component it saves it in a cache, so when the component reappears somewhere it doesnât need to download it, and it just grabs it from the cache. So the problem with having the gui disabled, shouldnât be an issue. But the only issue on why PreloadAsync wonât work is either: not using a LocalScript to preload the components, or giving in the wrong component idâs. Recheck the idâs of the components you entered to make sure theyâre the correct ones. You can do this by going to the image label(s), and looking at the Image property:
Then copy that property, and paste it into the assets table.
If after that it still doesnât work, then I donât really know why it wouldnât work (possibly a roblox issue).
How soon after loading the game do those GUIs appear? If they show up as soon as someone joins, the images still might not be loaded. Preloading doesnât make them load faster than they otherwise would.
I donât really know what you can do in this situation though. I think if you somehow make the GUI images be visible in the loading screen but the loading screen on top so it hides them then make them invisible again could make them load in time because they are loaded before the GUI actually appears.
I believe PreloadAsync() Is working, or mostly in your code. From what Iâve gathered from the documentation page about PreloadAsync() is that it forces it into a queue âRequest Queueâ; normally assets are loaded and put into the queue when the client needs them, this is why they appear to load after the player has loaded in. With a basic, potentially incorrect, assumption PreloadAsync() only tells the client which assets to download first and not when they have finished downloading. I blieve if you pair this function with ContentProvide.RequestQueueSize it may lead to better results (Although suggested by Roblox that you shouldnât base loading screens on this - RequestQueueSize*).
Iâm not very keen on this subject myself, as I donât personally use this service often. (Hope this helps)