local ContentProvider = game:GetService("ContentProvider")
Icons = {
empty = "rbxassetid://131719387",
key_icon = "rbxassetid://1367122183"
}
ContentProvider:PreloadAsync(Icons.key_icon) -- Unable to cast to Array
ContentProvider:PreloadAsync(Icons.empty)
✓ ANSWER ACCEPTED
preload image fail? (Unable to cast to Array)
1 answer
✓ Accepted answer
The function PreloadAsync expects an array of items, not an individual string for an asset.
See the API: https://developer.roblox.com/en-us/api-reference/function/ContentProvider/PreloadAsync
A similarly structured alternative to what you're doing could look like this:
local empty = "rbxassetid://131719387"
local key_icon = "rbxassetid://1367122183"
local Icons = {empty, key_icon}
ContentProvider:PreloadAsync(Icons);
Please let me know if this doesn't work!
This discussion is preserved as it was. New answers, comments, and votes are closed.
