ToolMenuButton

Having issues changing the spawn menu. I keep receiving this error in console:

This is the code that tries to create it:


 function PANEL:AddCategory(Label, tItems)
	self.Category = vgui.Create( "DCollapsibleCategory")
	self.ToolList:AddItem(self.Category)
	self.Category:SetLabel(Label)

	self.CategoryContent = vgui.Create("DPanelList")
	self.CategoryContent:SetAutoSize(true)
	self.CategoryContent:SetDrawBackground(false)
	self.CategoryContent:SetSpacing(0)
	self.CategoryContent:SetPadding(0)
	self.Category:SetContents(self.CategoryContent)


	local bAlt = true

	for k, v in pairs(tItems) do
		local Item = vgui.Create("ToolMenuButton")
		Item:SetText(v.Text)
		Item.OnSelect = function(button) self:EnableControlPanel(button) end
		concommand.Add(Format("tool_%s", v.ItemName), function() Item:OnSelect() end)

		if (v.SwitchConVar) then
			Item:AddCheckBox(v.SwitchConVar)
		end 

		Item.ControlPanelBuildFunction = v.CPanelFunction
		Item.Command = v.Command
		Item.Name = v.ItemName
		Item.Controls = v.Controls
		Item.Text = v.Text

		Item:SetAlt(bAlt)
		bAlt = !bAlt

		self.CategoryContent:AddItem(Item)
	end
end



Anyone help would be great!

Your calling a vgui.Create element that doesn’t exist if your going to make a button use [lua] local Item = vgui.Create (“DButton”) [/lua]