local t=script.Parent.TABS:GetChildren()for Z=1,#t,1 do local u=t[Z]:GetChildren()for t=1,#u,1 do function sell()hint=Instance.new("\072\105\110\116",script.Parent.Parent.Parent.Parent.PlayerGui);(Game:GetService("\068\101\098\114\105\115")):AddItem(hint,2)local Z=script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild("\071\111\108\100")local B=script.Parent.Parent.Parent.Parent.Backpack local a=script.Parent.Parent.Parent.Parent.StarterGear local x=B:FindFirstChild(u[t].Item.Value)local A=a:FindFirstChild(u[t].Item.Value)local b=u[t].SellPrice.Value if x~=nil and A~=nil then x:Remove()A:Remove()Z.Value=Z.Value+b hint.Text="\089\111\117 \115\111\108\100 "..(u[t].Text..(" \102\111\114 "..(u[t].PriceDisplay.Text.." \071\111\108\100\033")))elseif x==nil and A~=nil then A:Remove()Z.Value=Z.Value+b hint.Text="\089\111\117 \115\111\108\100 "..(u[t].Text..(" \102\111\114 "..(u[t].PriceDisplay.Text.." \071\111\108\100\033")))else hint.Text="\089\111\117 \100\111\110\'\116 \104\097\118\101 "..(u[t].Text.."\033")end end u[t].MouseButton1Click:connect(sell)end end
--This script should work. Only 30 lines. Amazing! Feel free to add more buttons in tab to your liking.

local tabs = script.Parent.TABS:GetChildren()
for i = 1, #tabs do
	local buttons = tabs[i]:GetChildren()
	for i = 1, #buttons do
		function sell()
			hint = Instance.new("Hint", script.Parent.Parent.Parent.Parent.PlayerGui)
			Game:GetService("Debris"):AddItem(hint, 2)
			local gp = script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild("Gold")
			local bp = script.Parent.Parent.Parent.Parent.Backpack
			local sg = script.Parent.Parent.Parent.Parent.StarterGear
			local bptool = bp:FindFirstChild(buttons[i].Item.Value)
			local sgtool = sg:FindFirstChild(buttons[i].Item.Value)
			local sellvalue = buttons[i].SellPrice.Value
			if bptool ~= nil and sgtool ~= nil then
				bptool:Remove()
				sgtool:Remove()
				gp.Value = gp.Value + sellvalue
				hint.Text = "You sold " .. buttons[i].Text .. " for " .. buttons[i].PriceDisplay.Text .. " Gold!"
			elseif bptool == nil and sgtool ~= nil then
				sgtool:Remove()
				gp.Value = gp.Value + sellvalue
				hint.Text = "You sold " .. buttons[i].Text .. " for " .. buttons[i].PriceDisplay.Text .. " Gold!"
			else
				hint.Text = "You don't have " .. buttons[i].Text .. "!"
			end
		end
		buttons[i].MouseButton1Click:connect(sell)
	end
end
