Changing ImageID Doesn't Change Image In GUI

:information_source: So I’m making this script for my game which automatically looks up an instance of a tool with the same name of a GUI element and changes the way the image inside of the GUI element appears accordingly through remotefunctions.

:question: This appears to work completely fine, as the Explorer proves that the ID . However, inside of the GUI, the image turns completely white. Here’s what the gui looks like before and after the automatic runthrough:

Before the runthrough

GUI:


Explorer/Properties:
image

After the run through

GUI:


Explorer/Properties:

:scroll: And the scripts (which I’m almost 100% sure aren’t the problem):

Local Script
local replicatedStorage = game:GetService("ReplicatedStorage")

local Info = script.Parent.Parent.Parent:WaitForChild("Info")

local ItemImage = script.Parent.Parent.Parent:WaitForChild("Info").ItemImage

local ItemPrice = ItemImage.Parent.ItemPrice

local ItemName = ItemImage.Parent.ItemName

local ItemOwned = ItemImage.Parent.Owned

local ItemEquipped = ItemImage.Parent.Equipped

local BuyButton = ItemImage.Parent.Buy

local ValuePrice = ItemImage.Parent.Price

local ShopinRep = replicatedStorage:FindFirstChild(script.Parent.Parent.Parent.Name)

--

local player = game.Players.LocalPlayer

local BuyScript = BuyButton.Buy

local SelectedItem = script.Parent.Parent.Parent.SelectedItem

local BuyButton = ItemPrice.Parent.Buy

local ImageID = ShopinRep.GetImage:InvokeServer(script.Parent.Name) -- Get Image ID

script.Parent.Image = ImageID -- Apply Image ID 
Server Script
local replicatedStorage = game:GetService("ReplicatedStorage")

local Name = script.Name

local Toolsbin = game:GetService("ServerStorage"):WaitForChild(Name)

local RSbin = replicatedStorage:WaitForChild(Name)

-- IMAGE

RSbin.GetImage.OnServerInvoke = function(player,item)

return Toolsbin[item].TextureId

end

:previous_track_button: So here’s a brief review of my problem:

  • The script works completely fine and puts the image id into the GUI Image like it should
  • The GUI Image “corrupts” and becomes white

:question: What I would like to know is why the GUI Image is "corrupting and becoming white, and what I can do to fix.

:information_source: MORE INFORMATION:

  • I am using a similar script to this for what is essentially a carbon copy of this GUI, and it gets the images completely fine

are you sure you are using the Image id vs the Decal id? when you set textureids via a script you must use the Image id for it to work (vs copying in the id in explorer it would auto find the image id)

1 Like

Yes I’m using Image instead of Decal right here:

Try using a different image and see what happens. If it continues then explore all the properties of the image label. Also try manually changing the image as well during runtime to see if it’s a problem with the script. Make sure you’re positive that the image works as well.

1 Like

So apparently the Image IDs are off by 1, because when I copy + paste just the number alone, it “corrects” the ID and subtracts 1 from it, for every single Image ID

1 Like

Okay so now I just gotta add the http://www.roblox.com/asset/?id=(insert number here) part, is this how I would correctly do it?

script.Parent.Image = "http://www.roblox.com/asset/?id=" .. ImageID

Okay so I got it to work by adding this line of code:

local ImageID = ShopinRep.GetImage:InvokeServer(script.Parent.Name)

local BaseID = "http://www.roblox.com/asset/?id="

script.Parent.Image = BaseID .. tostring (ImageID-1)

I also put a number ID inside of a value which the game extracts rather than the true ID

1 Like