Is there currently any way to convert an image’s asset id to an image id via script?
Did you meant Decal ID to Image ID?
If so then yes you can use InsertService for that
Yes this is what I mean, sorry
Use insertservice it will give you a model with decal.
To be safe validate it with marketplaceservice first tho.
Also make sure to delete model and decal after grabbing id
This works but do you think it looks alright?
local InsertService = game:GetService("InsertService")
local success, response = pcall(function()
local AssetID = InsertService:LoadAsset(config.SongImage)
if not AssetID:FindFirstChildWhichIsA("Decal") then return end
local NumberID = string.match(AssetID:FindFirstChildWhichIsA("Decal").Texture, "%d+")
MainFrame["Song Controls"].Image.Image = "rbxassetid://" .. NumberID
end)
if not success then
warn(response)
end
You can simplify it a bit without using closures:
local InsertService = game:GetService("InsertService")
local success, response = pcall(InsertService.LoadAsset,InsertService,config.SongImage)
if not success then
warn(response)
return
end
local decal:Decal? = response:FindFirstChildOfClass("Decal")
if decal == nil then response:Destroy() return end
local NumberID = string.match(decal.Texture, "%d+")
response:Destroy()--cleaning up instances
MainFrame["Song Controls"].Image.Image = "rbxassetid://" .. NumberID