Player Only Commands (+ Open UI)

Hello Developers,

I’ve got a Game and I want to make a Command for me alone and then a GUI opens but no one else is.


Can somebody help me make a script of this! If you can… Thank you very much! Then please explain a little bit where the script should be, what kind of scripter it is (Script/LocalScript/ModuleScript) and whether I need the gui in ServerStorage or in the script. I want the command that I can use it ONLY!

Thank you very much in advance for your help.


Sys. (Aka. Tim)

You can do this a few ways, but here is an easier one, for the GUI opening.

Inside of ServerScriptService, insert a script. And write:

local allowedPlayersByID = {
118001742, -- Your ID
1268610732 -- My ID

local admin ="BoolValue")
admin.Name = "Admin"

if player then
for i, v in pairs(allowedPlayersByID) do
if player.UserId == v then
admin.Parent = player

Then, inside of your GUI, insert a local script and write:

for i, v in pairs(game.Player:GetPlayers()) do
if v:FindFirstChild("Admin") then
local admin = v.Admin
if admin:IsA("BoolValue") then
script.Parent.FrameName.Visible = true
script.Parent.FrameName.Visible = false

As for the Commands, I would check this article out:

And just set it to check if the player speaking is an admin, like I have shown above.


Please do not ask people to write entire scripts or design entire systems for you.
This category is for asking for support (ex: your script isn’t working ad intended), not for asking people to write entire scripts.

You can handle the .Chatted event on the server. So you don’t have any chances of exploits, for the GUI, it should be located in StarterGui (So it gets cloned to PlayerGui). You would then immediately destroy the GUI on the client if the current player isn’t an admin. And don’t worry, if you have proper checks for each action the GUI does on the server, there’s absolutely no way a player can exploit even if they get access to the GUI!

The server sided event would look something like this

local Players = game:GetService("Players")
local adminList = {} --userids

    if table.find(adminList, player.UserId) then
             --you can use string operations to validate the commands

EDIT: Also please don’t ask for free scripts here as this isn’t the appropriate category, you can always hire someone to do things for you!

1 Like

I have a question what if u want the command to work for all players how would that work?