How to get image id from decal id?

I’m making a surfaceGui phone on studio and one of the features in the settings app is that you can change your wallpaper. To do this the player enters a decal asset id into a textbox which updates the wallpapers “Image” property (the wallpaper is an image label). However no matter what decal ID I use it never works. Even when trying “rbxassetid://” instead of “http://www.roblox.com/asset/?id=”. I noticed when you enter a decal asset ID into an ImageLabel through studio it works and it automatically changes the ID to a different ID which I believe is part of the problem since ImageLabel “Image” properties don’t get corrected while “in game”. I tried seeing if marketplace service had something to automatically correct the decal ID to a working ImageLabel ID but there was nothing. Here is the problem in the code:

local homescreen = script.Parent.Parent.Parent.Parent.HomeScreen

script.Parent.changeWallpaper.MouseButton1Click:Connect(function()
	--[[when you try changing the wallpaper it turns into a white screen
	but when you enter the id through roblox studio it changes fine but the id gets corrected to a different id]]--
	homescreen.Image = "http://www.roblox.com/asset/?id=".. script.Parent.assetid.Text
end)

Can you give an example of an ID automatically changing? I’ve never experienced this personally (except package to bundle IDs).

You’ll want to use a function like this:

I would also recommend supporting the feature request, if you want this to be a native feature.

1 Like

You probably need to get the asset image id and not the decal id. Use rbxthumb:// for that.
Try to use something like this:

homescreen.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", script.Parent.assetid.Text)
7 Likes