Scooby Wiki
Main site ↗

Lua scripts

Run examples in either edition and use the shared TF2 host API.

Lua scripts

  1. Open the menu’s Lua / Scripts manager or Lua Editor.
  2. Choose a bundled example such as TF2 Player HUD.lua or TF2 Player Labels.lua. Examples do not run automatically.
  3. Open the script in the editor and select Run. A HUD example needs an eligible local session with a local player; it can correctly draw nothing at the main menu.
  4. Use the editor’s Stop control to unload that script before making changes or rerunning it.
  5. Open API docs beside the editor for signatures and examples. The website API reference is searchable too.

One script, two editions

Use tf2 in scripts shared between retail and Classified. Classified also supplies tf2c as an alias. tf2.info() returns tf2 or tf2_classified as the game ID; tf2.capabilities() and tf2.has_feature(id) let you check edition-specific behavior.

Safe empty results

Check for nil before reading a local player or projection result. Game queries become empty when there is no eligible local session, during a transition, or after Stop. Read a fresh snapshot inside each callback.

Download examples and start scripting →

Copying scripts into an old build does not add a newer host API. Use the version and function names supplied by your installed TF2 package.

Search setup instructions, troubleshooting, and account help.

Type to search · Enter to open first result · Esc to close