How can I add the tool's name to this inventory GUI?

I’m trying to put the tool’s name onto the inventory GUI, but I don’t know how. The GUI only displays image IDs, not text. I’ve tried replacing the Image GUI with a text label and naming it Tool, but that doesn’t seem to work. I did find these lines of code, and I think their function is to put the tool’s name there if a text label’s name is detected to be Tool, but it doesn’t seem to work.

function create() – creates all the icons at once (and will only run once)

local toShow = #inputOrder -- # operator can only be used with an array, not a dictionary
local totalX = (toShow*iconSize.X.Offset)+((toShow+1)*iconBorder.x)
local totalY = iconSize.Y.Offset + (2*iconBorder.y)

frame.Size = UDim2.new(0, totalX, 0, totalY)
frame.Position = UDim2.new(0.5, -(totalX/2), 1, -(totalY+(iconBorder.y*2)))
frame.Visible = true -- just in case!

for i = 1, #inputOrder do
	
	local value = inputOrder[i]		
	local clone = template:Clone()
	clone.Parent = frame
	clone.Label.Text = value["txt"]
	clone.Name = value["txt"]
	clone.Visible = true
	clone.Position = UDim2.new(0, (i-1)*(iconSize.X.Offset)+(iconBorder.x*i), 0, iconBorder.y)
	clone.ImageTransparency = unequipped
	
	local tool = value["tool"]
	if tool then
		clone.Tool.Image = tool.TextureId
	end
1 Like

Please debug your code and explain what the exact problem is. Just saying “it doesn’t work” isn’t descriptive nor representative of the problem you’re encountering and without any debugging attempts from you nor isolating where the problem is (if it’s in the code and it’s not a case of missing code), it’s not exactly easy to help you out here.

2 Likes

Send some screenshots of the output window after running the code, if it has some errors we can help you find out.

here:

1 Like

What do you mean by debug? The exact problem is that I want to make the inventory GUI display the Item’s name instead of a texture ID, but I don’t know how.

If you don’t know what does debugging your script mean then take a look here Using the Lua Debugger

You probably lack some more code, what’s this “value” dictionary containing “txt” and “tool”? What are both of them?