Garry's Mod Wiki



We advise against using this. It may be changed or removed in a future update. Only exists for backwards compatibility with Panel:SetActionFunction. Use DButton instead.

Creates a button that players can click on.


Derives methods, etc not listed on this page from DLabel.


Creates a button with the text "Click Me" that when pressed prints "Hello World!" in the console.

local button = vgui.Create( "Button" ) button:SetSize( 150, 30 ) button:Center() button:SetVisible( true ) button:SetText( "Click Me" ) function button:OnMousePressed() print( "Hello World!" ) end