Hey there! Currently having a problem with setting an Image ID through script. The ID changes but it does not show the image. I have came to the conclusion that its changing the ID but not converting it into an Asset ID. So how do I convert a Decal ID to an Asset ID? I’ve surfed the web trying solutions but nothing is working. Thank you for your time!
Things I’ve tried:
local ID = tonumber(TextBox.Text)
ImageLabel.Image = "rbxassetid://"..ID
ImageLabel.Image = "https://www.roblox.com/asset/?id="..ID
Try fetching the asset using InsertService then indexing the Texture property of the returned asset for the correct URL. (a similar method is also used for shirts/pants)
local insertService = game:GetService("InsertService")
local function GetTextureFromAssetId(assetId: number): string?
local success, result = pcall(insertService.LoadAsset, insertService, assetId)
if success then
local asset = (result::Model):GetChildren()
texture = asset.Texture
-- test code
local texture = GetTextureFromAssetId(965496596)