Introducing
About WindUI
Setup
LoadstringThemes
UI
WindowKey SystemTabDialogPopupNotificationTagTab Section
Elements
SectionButtonToggleSliderInputDropdownParagraphKeybindColorpickerCodeDividerSpaceImageGroup (deprecated)HStack & VStack
Advanced
ConfigsIcons

Key System

Implement access control with key validation

Key System Overview

The Key System provides access control to your WindUI window. When enabled, users must enter a valid key before accessing the interface. This is useful for restricting access to premium, admin-only, or exclusive scripts.

Basic Usage

local Window = WindUI:CreateWindow({ -- creating window from /docs/windui/window
    Title = "Admin Panel",
    KeySystem = {
        KeyValidator = function(key)
            return key == "admin123"
        end,
    }
})

The KeySystem must be located inside the Window configuration table passed to WindUI:CreateWindow()

Parameters

Name
() required
: string?
: string?
: boolean?
: string?
: table?
: table?

Examples

Simple Key Validation

local Window = WindUI:CreateWindow({
  Title = "My Script",
  KeySystem = {
      KeyValidator = function(key)
          return key == "mySecretKey"
      end,
  }
})

Multiple Valid Keys

local Window = WindUI:CreateWindow({
  Title = "Admin Panel",
  KeySystem = {
      KeyValidator = function(key)
          local validKeys = {
              "owner_key",
              "admin_key", 
              "moderator_key"
          }
          return table.find(validKeys, key) ~= nil
      end,
      SaveKey = true
  }
})
local Window = WindUI:CreateWindow({
  Title = "Premium Features",
  KeySystem = {
      Title = "Premium Access",
      Note = "Click 'Get Key' button to open Discord",
      KeyValidator = function(key)
          return string.len(key) > 10
      end,
      SaveKey = true,
      URL = "https://discord.gg/yourserver"
  }
})

With Thumbnail

local Window = WindUI:CreateWindow({
  Title = "VIP Tools",
  KeySystem = {
      Title = "VIP Verification",
      KeyValidator = function(key)
          return string.sub(key, 1, 4) == "VIP-"
      end,
      SaveKey = true,
      Thumbnail = {
          Image = "rbxassetid://your_image_id",
          Title = "VIP Member",
          Width = 200
      }
  }
})

Save Key Behavior

When SaveKey is enabled:

  1. User enters key in the dialog
  2. Key is validated using KeyValidator
  3. If valid, key is saved to [Folder]/[player.Name].key
  4. On future runs, saved key is loaded and validated automatically
local Window = WindUI:CreateWindow({
  Title = "App",
  Folder = "MyApp", -- key saved to "MyApp/[player.Name].key"
  KeySystem = {
      KeyValidator = function(key)
          return key == "example"
      end,
      SaveKey = true -- enables persistence
  }
})