Garry's Mod Wiki



The TOOL table is used in Sandbox tool creation. You can find a list of callbacks on the page and a list of methods on the page. Do note that some of the fields below have no effect on server-side operations.

The tool information box drawn on the HUD while your tool is selected has 2 values that are set by language.Add.

  • tool.[tool mode].name - The tool name (Note this is NOT the same as TOOL.Name)
  • tool.[tool mode].desc - The tool description

Ensure that all tool file names are entirely lowercase. Including capital letters can lead to unintended behavior.


AddToMenu [boolean]

If set to false, the tool won't be added to the tool menu and players will have to access it by other means.

Default: true

Category [string]

The tool menu category under which the tool should be listed.

Default: "New Category"

Command [string]

The console command to execute upon being selected in the Q menu.

Default: "gmod_toolmode [tool]"

Name [string]

The name of the tool in the Q menu. Common practice is to set this to "#tool.[lua filename].name" to match the name displayed in the tool information box.

Default: "#[tool mode]"

ClientConVar [table]

A key-value ( convar name-default value ) table containing the client-side convars to create. All convars will be prefixed with the filename of the tool. You can later use Tool:GetClientNumber or Tool:GetClientInfo to retrieve these values.

ServerConVar [table]

Same as above, but created server-side instead.

BuildCPanel [function]

The function that is called to build the context menu for your tool. It has one argument, namely the context menu's base panel to which all of your custom panels are going to be parented to.

While it might sound like a hook, it isn't - you won't receive a self argument inside the function.

Information [table]

Allows you to override the tool usage information shown when the tool is equipped. See Tool Information Display for more information.

Mode [string]

Class name of the tool. (name of the .lua file)

This is set automatically.

Tab [string]

The tool tab (spawnmenu.AddToolTab) to add this tool to. (The internal name, first argument)

LeftClickAutomatic [boolean]

When enabled the game tries to run the left mouse click as soon as possible

Default: false

RightClickAutomatic [boolean]

When enabled the game tries to run the right mouse click as soon as possible

Default: false