Garry's Mod Wiki


  boolean SANDBOX:CanTool( Player ply, table tr, string toolname, table tool, number button )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.


Called when a player attempts to fire their tool gun. Return true to specifically allow the attempt, false to block it.


1 Player ply
The player who attempted to use their toolgun.
2 table tr
A trace from the players eye to where in the world their crosshair/cursor is pointing. See TraceResult structure
3 string toolname
The tool mode the player currently has selected.
4 table tool
The tool mode table the player currently has selected.
5 number button
The tool button pressed.


1 boolean
Can use toolgun or not.


Stops players from removing doors.

hook.Add( "CanTool", "CanToolExample", function( ply, tr, toolname, tool, button ) if toolname == "remover" and IsValid( tr.Entity ) and tr.Entity:GetClass() == "prop_door_rotating" then return false end end )