-- This must be a LocalScript local player = game.Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -- Create ScreenGui local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "KeySystemGUI" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = playerGui -- Create Frame local Frame = Instance.new("Frame") Frame.Size = UDim2.new(0, 300, 0, 200) Frame.Position = UDim2.new(0.5, -150, 0.5, -100) Frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40) Frame.Parent = ScreenGui -- Label local Label = Instance.new("TextLabel") Label.Size = UDim2.new(1, 0, 0, 50) Label.Position = UDim2.new(0, 0, 0, 0) Label.Text = "Enter Key" Label.TextColor3 = Color3.new(1, 1, 1) Label.BackgroundTransparency = 1 Label.Parent = Frame -- TextBox local TextBox = Instance.new("TextBox") TextBox.Size = UDim2.new(0.8, 0, 0, 40) TextBox.Position = UDim2.new(0.1, 0, 0.4, 0) TextBox.PlaceholderText = "Enter key here..." TextBox.Text = "" TextBox.ClearTextOnFocus = false TextBox.Parent = Frame -- Button local Button = Instance.new("TextButton") Button.Size = UDim2.new(0.8, 0, 0, 40) Button.Position = UDim2.new(0.1, 0, 0.7, 0) Button.Text = "Submit" Button.Parent = Frame -- Key check local correctKey = "12345" -- Action to run when key is correct local function onKeyAccepted() print("Key accepted! Running custom action...") -- You can replace the print with any function or action -- Example: give a tool to the player -- local tool = game.ServerStorage:FindFirstChild("Sword") -- if tool then -- tool:Clone().Parent = player.Backpack -- end end Button.MouseButton1Click:Connect(function() if TextBox.Text == correctKey then Label.Text = "Access Granted!" onKeyAccepted() -- Run the custom action else Label.Text = "Wrong Key!" end end)