Simulates a click on a button widget, triggering its PreClick/OnClick/PostClick script handlers.

Button:Click(["button"[, down]])


String - Mouse or virtual button to simulate a click with; if omitted, defaults to "LeftButton".
Boolean - true if the button should be considered pressed (but not yet released); otherwise, it'll be considered released.


  • This function does nothing if the Button widget is disabled, or if the button is already being clicked.
  • The arguments to this function will be passed to the widget's PreClick, OnClick, and PostClick script handlers.
  • This function ignores the widget's Button:RegisterForClicks preferences, and does not fire the OnMouseDown and OnMouseUp script handlers.
  • Only the specified click will be simulated; it is thus possible to simulate multiple down-clicks without any up-clicks or vice versa.
  • If you call this function from a tainted execution path, the OnClick handler will also run on a tainted execution path -- you cannot use this function to trigger protected actions from insecure code.
  • The /click slash command can be used to call this function securely.