My custom backpack gui won't tell which slot is tool inside

Hi, I working on my custom backpack gui, But there is a problem that i write the script that will tell you which slot that item are but it won’t work correctly

This is what my problem look like

I want make it like in example

Here my script

local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:FindFirstChild("Humanoid")
local inputkeys = {
	["One"] = {txt = "1"};
	["Two"] = {txt = "2"};
	["Three"] = {txt = "3"};
	["Four"] = {txt = "4"};
	["Five"] = {txt = "5"};
	["Six"] = {txt = "6"};
	["Seven"] = {txt = "7"};
	["Eight"] = {txt = "8"};
	["Nine"] = {txt = "9"};
	["Zero"] = {txt = "0"};
	
}
local inputOrder = {
	inputkeys["One"],inputkeys["Two"],inputkeys["Three"],inputkeys["Four"],inputkeys["Five"],
	inputkeys["Six"],inputkeys["Seven"],inputkeys["Eight"],inputkeys["Nine"],inputkeys["Zero "],
}
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
	for i,player in pairs(game.Players:GetPlayers()) do
	for i,v in pairs(player.Backpack:GetChildren()) do
		local canadd = true
			local gasdgasd = {}
			local test = #inputOrder
		if v:IsA("Tool") and canadd == true then
				local havedlist = {}
				local clonegui = script.Parent.Frame:Clone()
				if table.find(gasdgasd, v) then
					canadd = false
					return
			end
				clonegui.Parent = script.Parent
			clonegui.Name = v.Name
			game.Players.LocalPlayer.Backpack.ChildAdded:Connect(function()
				for i = 1, #inputOrder do
					if v.TextureId ~= "" then
						local slotnumber = inputOrder[i]
						clonegui.ImageLabel.Image = v.TextureId
						clonegui.Slot.Text = slotnumber["txt"]
					table.insert(gasdgasd, v)
					elseif v.TextureId == "" then
						local slotnumber = inputOrder[i]
						clonegui.Slot.Text = slotnumber["txt"]
					clonegui.Itemname.Text = v.Name
					clonegui.Visible = true
					clonegui.ImageLabel.Visible = false
					table.insert(gasdgasd, v)
					end
					end
			end)
			for i = 1, #inputOrder do
			if v.TextureId ~= "" then
					clonegui.ImageLabel.Image = v.TextureId
					local slotnumber = inputOrder[i]
					clonegui.Slot.Text = slotnumber["txt"]
				table.insert(gasdgasd, v)
			elseif v.TextureId == "" then
					clonegui.Itemname.Text = v.Name
					local slotnumber = inputOrder[i]
					clonegui.Slot.Text = slotnumber["txt"]
				clonegui.Visible = true
				clonegui.ImageLabel.Visible = false
				table.insert(gasdgasd, v)
				end
				end
				clonegui.MouseEnter:Connect(function()
					if v.ToolTip ~= "" then
						clonegui.Toolstipframe.ToolTips.Text = v.ToolTip
						clonegui.Toolstipframe.Visible = true
					end
					clonegui.MouseLeave:Connect(function()
						clonegui.Toolstipframe.Visible = false
					end)
					end)
			end
			end
		end
function handleequip(tool)
	if tool then	
		if tool.Parent ~= char then
			hum:EquipTool(tool)
		else
			hum:UnequipTools()
		end
	end
end

Sorry For Bad Grammar

1 Like

its alright this codes a lil bit of a mess though i gotta say, first of all you should use
a server script to do this

players.playeradded:Connect(function(Player) --just typing this off the top of my head might not be correct
    --put all your code here to remove the players GUI and clone your GUI into the players GUI
end)

and then you should handle the contents of the GUI in a local script

1 Like