How do i change an imagelabel's image when a textlabel's text changes

So i made a local script in startergui, whenever i would run the game it would print all the checks but never changes the image, how do i fix that? heres the script:

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local ImageLabel = PlayerGui.MainGui2.InventoryGui.Templates.Item.ImageLabel
local ItemName = PlayerGui.MainGui2.InventoryGui.Templates.Item.ItemName
ItemName:GetPropertyChangedSignal("Text"):Connect(function()
	print("Check 1") 
	if ItemName.Text == "Wood" then
		print("Check 2") 
		ImageLabel.Image = "rbxassetid://6421015650"
	end
end)

No what they had before was fine.

What does it print?

No it isn’t. Check the variables they defined and their arguements.

Where does it say .Text and .Image in this?

1 Like

Item.ImageLabel

Item.ItemName

Thats just getting the image label and the text button… (or at least it should be)

1 Like

Oh, mb, I misread it. They have too many parents, so I got confused.

1 Like

You should make sure the text says wood before you do the imagelabel check. Also is this a localscript or a script.

They said its a localscript and they check if the text says wood already.

it prints check2 telling me the text got changed

If it prints check2 then it should be working. Try doing a different image ( and double checking the variable is linked to the correct imagelabel )

what does this mean?

Could it be that you’re using decalid rather than imageid? When you change the image, does it show the placeholder image or does it not change anything at all. Try placing an image in the imagelabel and then play test and type Wood and see what happens, cause if everything should be working, it’s msot likely that you’re using DecalId rather than ImageId

What does your code look like right now?

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local ImageLabel = PlayerGui.MainGui2.InventoryGui.Templates.Item.ImageLabel
local ItemName = PlayerGui.MainGui2.InventoryGui.Templates.Item.ItemName
ItemName:GetPropertyChangedSignal("Text"):Connect(function()
	print("Check 1") 
	if ItemName.Text == "Wood" then
		print("Check 2") 
		ImageLabel.Image = "rbxassetid://6319951708"
	end
end)


I think that error is coming from somewhere else, is it breaking anything?

no? the only thing thats not working is the image not changing

do i need to use a remote event?

You can try using a remote event.

how do i connect a local script to a server script?