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

Inventoryry.rbxl (59.6 KB)

Does the text change to “wood”? (doesn’t have to be literal)--------

yeah im pretty sure it does but im not 100%

Try changing it manually-------------

shoudl i do a mousebutton1click event?

Try MouseButton1Down ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

IF text doesn’t change to wood then:






I think I see the problem. What if can’t find item list button right away. Change InventoryHandler thing to this:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DropItem = ReplicatedStorage:WaitForChild("DropItem")

wait(3)

local player = game.Players.LocalPlayer
local Inventory = player:WaitForChild("Inventory")


local MainGui = script.Parent
local InventoryGui = MainGui:WaitForChild("InventoryGui")

for i,itemValue in pairs(Inventory:GetChildren()) do
	itemValue.Changed:Connect(function()
		local ItemGui = InventoryGui.ItemList:FindFirstChild(itemValue.Name)
		if ItemGui then
			ItemGui.ItemQuantity.Text = itemValue.Value
			if itemValue.Value <= 0 then
				ItemGui.Visible = false
			else
				ItemGui.Visible = true
			end
		end
	end)
end

repeat wait() until #InventoryGui.ItemList:GetDescendants() > 1 -- 1 Is the grid layout
for i, ItemButton in pairs(InventoryGui.ItemList:GetDescendants()) do
	if ItemButton:IsA("TextButton") then
		ItemButton.MouseButton1Down:Connect(function()
			local itemFrame = ItemButton.Parent
			local itemValue = Inventory:FindFirstChild(itemFrame.Name)
			if itemValue.Value > 0 then
				local DropItem = DropItem:InvokeServer(itemFrame.Name) -- We need to make this do something
				if DropItem == true then
					if itemValue.Value > 0 then
						itemFrame.ItemQuantity.Text = itemValue.Value
					else
						itemFrame.Visible = false
					end
				end
			end
		end)
	end
end

WHAT IS THIS???

local itemValue = Inventory:FindFirstChild(itemFrame.Name)
			if itemValue.Value > 0 then
				local DropItem = DropItem:InvokeServer(itemFrame.Name) -- We need to make this do something
				if DropItem == true then
					if itemValue.Value > 0 then

what about that?

whats wrong?

alright so i put the script in serverscriptservice and it printed all the checks, but the image didn’t change

I know this is an Old Post , but here is the answer.

This should work :

"rbxthumb://type=Asset&id="..tonumber(YOUR_ID_HERE).."&w=150&h=150"
2 Likes