Hello,
I’m working on creating a random image generator using InsertService’s GetFreeDecals, however it returns assets that aren’t images which causes an error. I’m quite confused because the name implies that it should return an image, this is even backed up by Roblox’s own description of GetFreeDecals.
My other problem is that GetFreeDecals returns decals that aren’t public even though the service is supposed to return public and free decals.
Script
local InsertService = game:GetService("InsertService")
local PossibleQueries = {"desktop hd wallpaper", "meme", "wallpaper 4k", "hd wallpaper", "anime wallpaper", "fanart"}
local QueryRNG = math.random(1,#PossibleQueries)
local Query = PossibleQueries[QueryRNG]
local Page = unpack(InsertService:GetFreeDecals(Query,math.random(1)))
local PageRNG = math.random(1,Page.TotalCount)
local Success = false
local Asset = Page.Results[PageRNG]
local AssetDetails = {}
for Detail,String in pairs(Asset) do
table.insert(AssetDetails,String)
end
script.Parent.Image = "rbxassetid://"..AssetDetails[3]