OBS Studio Keystroke Overlay Lua Script Guide

Learn how to display your real-time keyboard inputs directly on your stream or recording using OBS Studio. This guide walks you through the process of setting up a custom Lua script, linking it to an OBS text source, and customizing the keystroke history overlay for a clean, professional presentation.

Step 1: Prepare Your Lua Script

To display keystrokes, you need a custom Lua script (typically a .lua file) designed to log system inputs and output them to OBS. Ensure you have the script file downloaded and saved in a dedicated folder on your computer where it will not be accidentally deleted.

Step 2: Create a Text Source in OBS

The Lua script requires an active text source in OBS Studio to display the captured keystrokes.

  1. Open OBS Studio.
  2. In the Sources dock, click the + (Add) button.
  3. Select Text (GDI+) from the list.
  4. Name the source (e.g., “Keystroke Display”) and click OK.
  5. Leave the text field empty and click OK to save the source.

Step 3: Load the Lua Script into OBS

  1. In the top menu bar of OBS Studio, click on Tools and select Scripts.
  2. In the Scripts window, make sure you are on the Loaded Scripts tab.
  3. Click the + (Add) button in the bottom-left corner.
  4. Navigate to the folder where you saved your custom .lua script, select it, and click Open.

Step 4: Configure the Script Settings

Once the script is loaded, you must link it to the text source you created.

  1. Click on the loaded script name in the Loaded Scripts list to highlight it.
  2. Look at the right pane of the Scripts window to view the script’s settings.
  3. Locate the dropdown menu (usually labeled Text Source) and select the “Keystroke Display” source you created in Step 2.
  4. Adjust any custom settings provided by your specific script, such as:
    • Keystroke History Limit: The number of characters or words displayed on screen at once.
    • Fade Time: How long keys remain on screen before disappearing.
    • Layout Style: Horizontal or vertical display of input history.
  5. Click Close when finished.

Step 5: Format and Position the Overlay

Now that the script is actively sending key data to your text source, you can customize how it looks on your stream.

  1. Select the “Keystroke Display” source in your Sources list.
  2. Right-click the source and select Properties to change the font, color, outline, or gradient settings.
  3. In the OBS preview window, click and drag the red bounding box around the text source to resize it and position it where you want your viewers to see it.