Amazon holiday deals See deals →ad

Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

How to Make an Admin Panel in Roblox Studio

Creating an admin panel in Roblox Studio lets you control your game from a simple GUI — kicking players, teleporting, granting tools, or changing game settings without touching code mid-session. This guide walks you through building a basic admin panel using a LocalScript, a ServerScript, and a ScreenGui. You’ll need Roblox Studio (free) and basic familiarity with the Explorer and Properties windows.

What You’ll Need

  • Roblox Studio installed on your computer
  • A place (game) to work in — any template works
  • Basic understanding of the Explorer panel (where parts and scripts live)
  • Willingness to copy-paste code — no prior scripting knowledge required

Step-by-Step

  1. Open your place in Roblox Studio. Start with a baseplate template or any existing game you want to add the panel to.
  2. Create a ScreenGui. In the Explorer, hover over StarterGui (under the game hierarchy), click the + icon, and select ScreenGui. Name it AdminPanel. This GUI will appear on every player’s screen when they join.
  3. Add a Frame. Inside AdminPanel, add a Frame (right-click AdminPanel → Insert Object → Frame). Name it MainFrame. Set its AnchorPoint to (0.5, 0.5), Position to (0.5, 0, 0.5, 0), and Size to (0, 400, 0, 300) in the Properties window. This creates a centered 400×300 box.
  4. Style the frame. Set the Frame’s BackgroundColor3 to a dark color (like 30, 30, 30) and add a UICorner (right-click MainFrame → Insert Object → UICorner) for rounded edges. Set its CornerRadius to (0, 8).
  5. Add a title label. Inside MainFrame, add a TextLabel. Name it Title. Set its Size to (0, 400, 0, 40), Position to (0, 0, 0, 0), and Text to “Admin Panel”. Center the text by setting TextScaled to true and TextColor3 to white.
  6. Add a player list. Insert a ScrollingFrame inside MainFrame (right-click → Insert Object). Name it PlayerList. Set its Size to (0, 380, 0, 200), Position to (0, 10, 0, 50), and BackgroundColor3 to a lighter gray (like 50, 50, 50). This will display clickable player names.
  7. Add action buttons. Create three TextButtons inside MainFrame (right-click → Insert Object → TextButton). Name them KickButton, TeleportButton, and FreezeButton. Position them in a row at the bottom: set each Size to (0, 100, 0, 30), Position to (0, 20, 0, 260), (0, 140, 0, 260), and (0, 260, 0, 260) respectively. Set their Text to “Kick”, “Teleport”, and “Freeze”.
  8. Create a command bar (optional). Add a TextBox inside MainFrame for custom commands. Set its Size to (0, 380, 0, 30), Position to (0, 10, 0, 220), and PlaceholderText to “Type command…”. You can skip this if you only want the buttons.
  9. Add a LocalScript. In the Explorer, right-click AdminPanel → Insert Object → LocalScript. Name it PanelUI. This script runs on the player’s computer and handles clicks.
  10. Write the LocalScript code. Open PanelUI and replace its contents with:
    local panel = script.Parent
    local mainFrame = panel:WaitForChild("MainFrame")
    local playerList = mainFrame:WaitForChild("PlayerList")
    local kickButton = mainFrame:WaitForChild("KickButton")
    local teleportButton = mainFrame:WaitForChild("TeleportButton")
    local freezeButton = mainFrame:WaitForChild("FreezeButton")
    
    -- Reference the server script
    local remoteEvent = script.Parent:WaitForChild("RemoteEvent")
    
    -- Function to refresh the player list
    local function refreshList()
        playerList:ClearAllChildren()
        for _, player in ipairs(game.Players:GetPlayers()) do
            local button = Instance.new("TextButton")
            button.Size = UDim2.new(0, 360, 0, 30)
            button.Text = player.Name
            button.Parent = playerList
            button.MouseButton1Click:Connect(function()
                -- Store selected player in a variable
                _G.selectedPlayer = player
            end)
        end
    end
    
    refreshList()
    game.Players.PlayerAdded:Connect(refreshList)
    game.Players.PlayerRemoving:Connect(refreshList)
    
    -- Button click handlers
    kickButton.MouseButton1Click:Connect(function()
        if _G.selectedPlayer then
            remoteEvent:FireServer("Kick", _G.selectedPlayer)
        end
    end)
    
    teleportButton.MouseButton1Click:Connect(function()
        if _G.selectedPlayer then
            remoteEvent:FireServer("Teleport", _G.selectedPlayer)
        end
    end)
    
    freezeButton.MouseButton1Click:Connect(function()
        if _G.selectedPlayer then
            remoteEvent:FireServer("Freeze", _G.selectedPlayer)
        end
    end)
        
  11. Add a RemoteEvent. Right-click AdminPanel → Insert Object → RemoteEvent. Name it RemoteEvent. This allows the client to ask the server to perform actions.
  12. Add a ServerScript. In the Explorer, right-click ServerScriptService → Insert Object → Script. Name it AdminServer. This runs on the server and has authority to kick/teleport/etc.
  13. Write the ServerScript code. Open AdminServer and replace its contents with:
    local remoteEvent = game.StarterGui:WaitForChild("AdminPanel"):WaitForChild("RemoteEvent")
    
    -- Define admin players (replace with your username)
    local admins = {
        ["YourUsernameHere"] = true
    }
    
    remoteEvent.OnServerEvent:Connect(function(player, action, targetPlayer)
        -- Check if the player is an admin
        if not admins[player.Name] then
            warn(player.Name .. " tried to use admin panel but is not an admin!")
            return
        end
    
        if action == "Kick" then
            targetPlayer:Kick("Kicked by admin.")
        elseif action == "Teleport" then
            -- Teleport to a specific part (replace with your part's name)
            local destination = game.Workspace:FindFirstChild("SpawnLocation")
            if destination then
                targetPlayer.Character:SetPrimaryPartCFrame(destination.CFrame)
            end
        elseif action == "Freeze" then
            local character = targetPlayer.Character
            if character then
                local humanoid = character:FindFirstChildOfClass("Humanoid")
                if humanoid then
                    humanoid.WalkSpeed = 0
                    -- Unfreeze after 5 seconds
                    task.wait(5)
                    humanoid.WalkSpeed = 16
                end
            end
        end
    end)
        

    Replace “YourUsernameHere” with your actual Roblox username.

  14. Test your panel. Click the Play button (or press F5) to test. You should see the admin panel on your screen. Click a player’s name in the list to select them, then click a button to perform the action. Note: You must be logged in as the username you set in the server script for it to work.
  15. Publish your game. Once it works, you can publish the place to Roblox. The panel will appear for all players, but only your username can use it.

Common Mistakes

  • Forgetting to set your username: If you don’t replace “YourUsernameHere” with your actual username, the server script will reject all commands.
  • Using a Script instead of a LocalScript for the GUI: The GUI must be controlled by a LocalScript (client-side), not a regular Script (server-side), or it won’t update correctly.
  • Misnaming objects: The code uses exact names (MainFrame, PlayerList, etc.). If you rename an object, the script won’t find it and will error.
  • Not adding a RemoteEvent: Without it, the LocalScript can’t communicate with the server. Ensure the RemoteEvent is a child of AdminPanel.
  • Teleporting without a character: If the target player’s character is not loaded (e.g., they’re in the loading screen), the teleport code will error. Always check if Character exists.

Tips

  • Use a more robust admin system: For a production game, consider using a free admin module from the Toolbox or the Roblox Creator Store — they handle permissions, commands, and UI better.
  • Add more actions: Extend the script with buttons for banning, giving tools, or changing game settings. Just add new buttons and corresponding if-statements.
  • Make the panel toggleable: Bind a key (like F1) to show/hide the panel using a LocalScript that changes the frame’s Visible property.
  • Secure your admin list: Instead of hardcoding usernames, use a configuration module or check if the player’s UserId is in a whitelist stored in a ServerStorage folder.
  • Test with two accounts: To test admin actions on another player, you need to join the game with a second account (or use Studio’s “Run” with a second client).

Troubleshooting

  • Buttons don’t work: Check the Output window (View → Output) for errors. Common causes: missing RemoteEvent, misspelled object names, or the server script not being in ServerScriptService.
  • Panel doesn’t appear: Ensure the ScreenGui is under StarterGui, not just anywhere in the game. Also check that the LocalScript is under the ScreenGui, not in ServerScriptService.
  • Player list is empty: The refreshList function runs when the script starts. If no players are in the game, it’s empty. Join with a second account to see them.
  • “Kick” doesn’t kick: Make sure your username is exactly as it appears in the admins table (case-sensitive). Also verify that the targetPlayer variable is not nil — you must select a player first.
  • Teleport sends player to wrong place: The code teleports to a part named “SpawnLocation”. If you don’t have one, create a Part and rename it, or change the code to teleport to a specific coordinate.
  • Freeze doesn’t unfreeze: The unfreeze happens after 5 seconds. If the player dies or the character changes, the humanoid reference becomes invalid. You can use a debounce to handle this.

Related

Frequently Asked Questions

  • Can I give admin to other players? Yes, just add their usernames to the admins table in the ServerScript. You can also create a whitelist system using a module.
  • Is this safe from exploiters? The server script checks the player’s name, so it’s fairly secure. However, exploiters can spoof RemoteEvents. For better security, use a server-side validation that checks the player’s UserId and possibly a permission token.
  • How do I add a custom command like “kill”? Add a new button and in its click handler, fire the RemoteEvent with a new action string. Then in the server script, add another elseif branch.
  • Why does the panel show for everyone? Because it’s in StarterGui, it appears for all players. To restrict visibility, you can add a check in the LocalScript to only show the panel if the player is an admin (by comparing their username to a list).
  • Can I make the panel draggable? Yes, add a small script to the MainFrame that uses UserInputService to move the frame when dragged.
  • Does this work in Roblox mobile? Yes, the GUI works on all platforms, but you may need to adjust the size and touch controls for smaller screens.
How to Make an Admin Panel in Roblox Studio
Scroll to top