Change decal texture to id put in text box

Hi
I am trying to make a gui where you can change decal’s texture by putting it’s id from the library into a textBox.

thing.Texture = "http://www.roblox.com/asset/?id=" .. newValue

It doesn’t work and I know why but I have no clue how would I fix it. It doesn’t work because the id in the library is different than the one in the texture tab.
For example id “8120716264” changes to “8120716241” while put in the decal.Texture box in the editor. Any ideas how would I convert the id from library to a useable one like studio does?

1 Like

You can use the thumbnail endpoint, although it doesn’t work 100% of the time:

thing.Texture = "rbxthumb://type=Asset&w=768&h=432&id="..newValue
3 Likes

Thanks, I will try it! But why doesn’t it work 100% of the time? And btw is there anyway to know if the provided decal id/link is invalid?

Well it works 99% of time according to devforum posts, the decal to asset id issue exists a long time now and people have found very creative ways to counter it(like decreasing the id by 1 until MarketplaceService:GetProductInfo() works, or using an external API) although I consider this method the less painful one.

Also to know if its valid/invalid you can try to load it inside a ImageLabel and check if IsLoaded is set to true after a small amount of time(for example 0.5-1 seconds)

1 Like

I thought you could just do

thing.Texture = 'rbxassetid://' .. id

which seems like a simpler way

1 Like

Thank you very much for this detailed explanation. :smiley:

1 Like