Hi Creators,
When developing this feature we knew about some historical usage of sequential IDs to translate decal ids into image IDs, but underestimated how many creators were still relying on that approach. Thank you for your feedback on this.
The sequential ID trick is an unfortunate solution thanks to eating up a large amount of http request budget. Instead of continuing to support the sequential ID trick, we’ve enabled a more convenient solution.
Decal assets are technically Models containing a Decal Instance. You can extract the image ID easily after loading the Decal with InsertService:LoadAsset, but previously this only worked on Decals you owned, failing with public Decals.
Today, we updated the InsertService. It can now insert any publicly available Decal. That means you can now use InsertService to reliably translate the ID in a single request. Here’s a production-ready reference implementation:
local InsertService = game:GetService("InsertService")
-- Takes in a user input containing the assetId of either a decal
-- or image and returns an image assetId string ready for use or an
-- empty string if no assetId could be found.
function getImageFromUserInputAsync(decalOrImageAssetUri: string): string
local a, b = decalOrImageAssetUri:find("%d+")
if not a then
-- Return an empty assetId in the case of no id in input.
return ""
end
local assetId = tonumber(decalOrImageAssetUri:sub(a, b))
local st, result = pcall(InsertService.LoadAsset, InsertService, assetId)
if st then
local decal = result:FindFirstChildWhichIsA("Decal", true)
if decal then
-- Note: Do not directly parent the found Decal to avoid
-- security issues if untrusted Instances somehow ended up
-- underneath it. Instead, extract the id.
return decal.Texture
end
end
return `rbxassetid://{assetId}`
end
We’re also delaying the non-sequential ID launch by a week to allow creators additional migration time.
Thank you for your patience.
FAQs
What if I don’t migrate?
- Your code will continue to work on existing Decals but will start failing on new ones as we complete the move to non-sequential ids.
Can I load non-Decal assets in the same way?
- The insert permission change applies to Decal assets only, not to other assets like Models.
What are the “Untrusted Instances” mentioned in the reference?
- Some Decals from very early in Roblox history may have non-Decal Instances smuggled inside of them. In the unlikely event malicious Decals exist, the reference implementation shows how to handle things safely by extracting the id rather than inserting the Decal directly.