My script is supposed to show a decal by its ID but for some weird reason most of the times it doesnt work. The only time it works is when im putting in the '1234567' and it uploads some off-topic image. Here is the code:
local textBox = script.Parent local Image = script.Parent.Parent.Image textBox.FocusLost:Connect(function() Image.Image = 'http://www.roblox.com/asset/?id=' ..textBox.text end)
On the line five ive also wrote 'rbxassetid://' before but it doesnt change anything. Any idea of a fix to this?
Oh. Almost forgot. Here is the output for it
14:59:00.865 - Image "https://assetdelivery.roblox.com/v1/asset?id=904635292" failed to load in "Players.SrOgurman.PlayerGui.ScreenGui.Image.Image": Request failed
UPDATE Weirdly it only works with some 7 digits numbers
This is because of Roblox's slow speed of matching ids correctly to their image, this can be solved by creating a Decal and putting in the texture and then getting the reformatted texture:
local function getImageID(decal) -- set decal local Decal = Instance.new("Decal") Decal.Texture = "rbxassetid://" .. decal -- studio will auto update this local ImageID = Decal.Texture Decal:Destroy() -- remove unwanted decal return ImageID end -- usage: getImageID(000000)