Part texture will not load assetids derived from InsertService:GetFreeDecals()

I’ve been trying to make a script which gets a random decal id, via InsertService:GetFreeDecals(), however while the script can get a random decal’s asset id, when it tries to apply it, it fails to load. I’ve looked for a solutions but nothing has helped for me. I figure this is a problem with how I wrote the link, but I can’t be certain.

local insert = game:GetService("InsertService")
local array = insert:GetFreeDecals("winning",math.random(10,20))
local a2 = array[1]
local a3 = a2["Results"]
local a4 = a3[math.random(1,21)]
local id = a4["AssetId"]
print(a4)
local tx = "rbxassetid://" .. tostring(id)
script.Parent.r.Texture = tx
script.Parent.r2.Texture = tx
1 Like

image id and decal id are 2 different things, in this case you want the image id
you can convert the decal id to an image one using rbxthumb

local tx = "rbxthumb://type=Asset&id=" .. id .. "&w=420&h=420"
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.