Skip to main content

Overview

The KeySystem blocks the window from opening until the user submits a valid key. It is configured inside the CreateWindow config under the KeySystem field. When KeySystem is present, WindUI renders a modal key dialog before creating the window. The dialog closes and the window opens only after a valid key is accepted.
local Window = WindUI:CreateWindow({
    Title  = "My Hub",
    Folder = "myhub",   -- required when using SaveKey

    KeySystem = {
        Title   = "My Hub — Key Required",
        Key     = "supersecretkey",
        SaveKey = true,
    },
})

Config Fields

KeySystem.Title
string
Title text shown at the top of the key dialog. Defaults to the window Title when omitted.
KeySystem.Key
string | table
The accepted key or list of accepted keys.
  • Pass a string for a single valid key.
  • Pass a table (array of strings) to accept any key in the list.
Not required when using API or KeyValidator.
KeySystem.SaveKey
boolean
When true, a validated key is written to disk at:
<Folder>/<hwid>.key
On subsequent launches WindUI reads this file and skips the dialog if the saved key is still valid.
Requires Folder to be set in the window config. When Folder is absent, the path falls back to Temp/<hwid>.key.
KeySystem.KeyValidator
function
A custom validation function. Receives the entered key string and must return true (valid) or false (invalid).
KeyValidator = function(key)
    return string.len(key) == 32
end,
When KeyValidator is set, Key and API are ignored.
KeySystem.API
table
An array of external API service configurations for third-party key validation (e.g. Platoboost, Panda Development). Each entry specifies a Type matching a registered service and the service-specific arguments.When API is present, the dialog shows a “Get key” button with a dropdown listing each configured service.
KeySystem.URL
string
A URL copied to the clipboard when the user clicks “Get key” in the dialog. Useful as a simple link to a key provider without a full API integration.
KeySystem.Note
string
Additional note text rendered in the dialog body (supports RichText).
KeySystem.Thumbnail
table
An optional image panel displayed on the left side of the key dialog.
Thumbnail = {
    Image = "rbxassetid://123456789",
    Width = 200,    -- pixel width (default 200)
    Title = "My Hub",  -- optional label over the image
},

Examples

1. Static Single Key

The simplest setup — one hardcoded key, no saving.
local Window = WindUI:CreateWindow({
    Title  = "My Hub",
    Folder = "myhub",

    KeySystem = {
        Title = "Enter Key",
        Key   = "mykey-abc123",
    },
})

2. Multiple Valid Keys

Pass a table to accept any one of several keys. Useful for per-user or tiered access.
local Window = WindUI:CreateWindow({
    Title  = "My Hub",
    Folder = "myhub",

    KeySystem = {
        Title = "Enter Key",
        Key   = {
            "key-alpha-001",
            "key-beta-002",
            "key-gamma-003",
        },
    },
})

3. SaveKey — Persist After First Entry

The user enters the key once; it is saved to <Folder>/<hwid>.key. On future runs, the dialog is skipped automatically if the saved key is still valid.
local Window = WindUI:CreateWindow({
    Title  = "My Hub",
    Folder = "myhub",   -- determines save path: myhub/<hwid>.key

    KeySystem = {
        Title   = "Enter Key",
        Key     = "permanent-key-xyz",
        SaveKey = true,
    },
})
The save path is (Config.Folder or "Temp") .. "/" .. hwid() .. ".key". Where hwid() resolves to gethwid() when available, or falls back to the player’s UserId.

4. Custom KeyValidator

Use KeyValidator when you need arbitrary validation logic — checksum checks, length constraints, prefix matching, HTTP lookups, etc.
local Window = WindUI:CreateWindow({
    Title  = "My Hub",
    Folder = "myhub",

    KeySystem = {
        Title = "Enter License Key",

        -- Key is valid if it starts with "HUB-" and is 36 chars long
        KeyValidator = function(key)
            return string.sub(key, 1, 4) == "HUB-" and string.len(key) == 36
        end,

        SaveKey = true,  -- save on first successful validation
    },
})

5. Thumbnail + Note

Add a decorative thumbnail and a note to give users context.
local Window = WindUI:CreateWindow({
    Title  = "My Hub",
    Folder = "myhub",

    KeySystem = {
        Title = "My Hub",
        Key   = "my-key",
        Note  = "Join the Discord to obtain a key.",
        URL   = "https://discord.gg/example",

        Thumbnail = {
            Image = "rbxassetid://123456789",
            Width = 200,
            Title = "My Hub",
        },
    },
})

Validation Flow

The diagram below describes how WindUI resolves a key on each launch.
1

KeySystem present?

If KeySystem is not in the config, the window opens immediately with no gate.
2

Check saved key (when SaveKey = true)

If a .key file exists at <Folder>/<hwid>.key, WindUI reads it and validates it silently using KeyValidator, the static Key/Key table, or the API services. If valid, the window opens without showing the dialog.
3

Show key dialog

The dialog is shown if there is no saved key, or if the saved key failed validation.
4

User submits a key

The entered key is validated against KeyValidator, Key/Key[], or API services.
5

Valid key

If SaveKey = true, the key is written to <Folder>/<hwid>.key. The dialog closes and the window opens.
6

Invalid key

A notification is shown: “Key System. Error — Invalid key.” The dialog stays open.

Notes

The KeySystem dialog blocks script execution until a valid key is submitted. It uses repeat task.wait() until CanLoadWindow internally. Make sure your key source is reachable from the executor environment.
KeyValidator, static Key, and API are mutually exclusive in priority: KeyValidator is checked first, then static Key, then API.

Build docs developers (and LLMs) love