How do i make an image label change when a text labels text is == to something?

And your not getting any prints or anything?

yes

Does the text of itemname update at any point?

yes, the item text updates

So do something like this…

ItemName:GetPropertyChangedSignal("Text"):Connect(function()
	if ItemName.Text == "Wood" then
		ImageLabel.Image = "rbxassetid://6421015596"
	end
end)

that doesn’t work either which is strange

check to verify that it knows that the text changes.

So it did print if the text was changed, so make sure that if the text is wood see if it prints something.

oh my bad i meant it wasn’t printing

ItemName:GetPropertyChangedSignal("Text"):Connect(function()
print("Working here?") -- add a print here
	if ItemName.Text == "Wood" then
print("Working here?") -- add a print here
		ImageLabel.Image = "rbxassetid://6421015596"
	end
end)

see where the problem is occurring

1 Like

hm it isn’t even printing the first part nor the second

If your not getting errors than you might just have a whole different issue on your hands

Can you show the full code of the LocalScript again, with all changes?

This is the local script i have right now

ItemName:GetPropertyChangedSignal("Text"):Connect(function()
print("Working here?") -- add a print here
	if ItemName.Text == "Wood" then
print("Working here?") -- add a print here
		ImageLabel.Image = "rbxassetid://6421015596"
	end
end)

what bigger issue could it be?

If that’s the entire LocalScript, then your issue lies in the fact that absolutely none of the variables are defined (ItemName and ImageLabel are both not defined).

oh no, my script got cut off my bad

heres the one with the variables

local ImageLabel = script.Parent.InventoryGui.Templates.Item.ImageLabel
local ItemName = script.Parent.InventoryGui.Templates.Item.ItemName
ItemName:GetPropertyChangedSignal("Text"):Connect(function()
	print("Check 1") -- add a print here
	if ItemName.Text == "Wood" then
		print("Check 2") -- add a print here
		ImageLabel.Image = "rbxassetid://6421015596"
	end
end)

is the text being updated after the game starts?

I’m still not entirely sure what the problem is. Would you mind posting the place as a file so I could check that?