Image not changing from TextBox

Hello, I have encountered a problem, where the Image doesn’t change Its Image ID.

Now, This script is meant to change it

local Textbox = script.Parent.Parent.Name_of_Image
local Image = script.Parent

Image.Image = Textbox.Text

When I enter my Image Id in the textbox, It does not change.

This is the textbox:
image
and this is the image (It didn’t change into the image I wanted it to change to.):
image

2 Likes

First of all it is not a good practice to make the names of your objects same names that their properties are. Change your image name, you can do something like “MainImage”.

Also show us your hierarchy, maybe you are referencing the elements wrong

I checked that 100 times and I’m 1000% Sure that I referenced it correctly.

1 Like

Try this:

local gui = script:FindFirstAncestorOfClass("ScreenGui");
local box = gui.TextBox;
local label = gui.ImageLabel;

local url = "rbxthumb://type=Asset&id=%i&w=150&h=150";

box:GetPropertyChangedSignal("Text"):Connect(function()
	if not tonumber(box.Text) then return; end
	label.Image = url:format(tonumber(box.Text));
end)

(Don’t add the rbxassetid://, just enter the id directly)

3 Likes