How to make admin commands in roblox studio
How to make admin commands in roblox studio
Chat Modules
Purpose
An admin command is a common feature in Roblox games where a player can type a command into the chat window which will trigger a game action. This library allows for easy implementation of admin commands on top of the Roblox chat system.
This library uses ChatModules to allow you to easily link behaviors that you write to chattable commands. ChatModules listen to incoming messages on the server and can execute actions based on whatever criteria is desired.
Prerequisites:
Setup
Implementing New Commands
Binding a command
Rather than implementing most of the Chat Module logic you will simply require the library module that does a bulk of the work and adds extra functionality. The simplest way to add the library into your module is to require it by its assetId at the top of your script.
Between these two lines of code is where you will be implementing your own commands and any necessary helper functions.
In order to bind a function to the library, you will use the BindCommand function of AdminCommands. When binding a command you will need to specify a table of keywords that, when spoken, will trigger the command, the function that will be triggered, a priority level, and optionally, a description of the command. If you do not specify a privilege level it will default to 0. Priority levels are numerical values used by the AdminCommands library to assign a hierarchy of permission amongst users with corresponding levels of granted privilege. When executing a command the speaker must have a privilege level that is greater than or equal to that of the command Permission Library.
To unbind you would likewise use UnbindCommand and specify a keyword to unbind.
Altogether, the content of your AdminCommands script should look like the following:
You may notice that the example function takes a parameter named commandData. This parameter is a table argument passed along to all bound admin command functions when executed by the library. The table contains useful information about the command that was spoken and the player who spoke it. It has the following fields:
It is important to always expect commandData as a parameter of command functions. For example, if you have a command named “explode’, which requires a player parameter to be specified, the function would look like explode(commandData, player).
Function | Parameters | Return |
---|---|---|
Commands: | ||
BindCommand() | table functionIDs, function functionToExecute, number minimumPermissionLevel, string description | bool |
UnbindCommand() | table functionIDs | bool |
GetCommands() | table |
Utilities
The library already has a few built-in helper functions called Utilities that you can use. Store AdminCommand.Utilities in a variable or reference it directly.
Current utility functions are:
Example commands
A useful command to have would be one that prints a list of all optional commands that users have available. This command outputs each command bound to the library and a few of its properties.
Another helpful command allows users to give themselves sparkles. This command requires one parameter when spoken – the targeted player’s name. If the player exists, the command will create a Sparkles object in the HumanoidRootPart of that player.
You can also include an explosion command from the Created an Admin Command tutorial. This command also takes a player’s name as a parameter.
Permission Library
If a non-admin tries to speak a command like this, which has a higher permission level than 0, it will not be triggered. The command system uses a separate Permission library, to which the game creator is automatically given the permission level math.huge. Admins can be added using the following functions on your AdminCommands module object. More functions can be found by looking at the library’s source code:
Function | Parameters | Return |
---|---|---|
Permission | ||
GetAdmins() | table | |
SetUserPermission() | number requesterUserId, number targetUserId, permissionLevel | bool |
GetUserPermission() | number userId | number |
GetGroups() | table | |
SetGroupRankPermission() | number requesterUserId, number targetGroupId, number targetRankId, permissionLevel | bool |
GetGroupRankPermission() | targetGroupId, targetRankId | int |
GetUserGroupRankPermission() | number userId | int |
Quick-Start Module
For easier setup you can also use this Quick Start, which is a module that has already implemented the Admin Commands library. The model is a module with the same format as described above. Additionally, the module has a few commands already included so that you do not have to re-implement.
Command/Binding | Spoken Parameter |
---|---|
“list”, “commands” | username |
“sparkles” | username |
“sparkles” | username |
“unforcefield”, “unff” | username |
“explode” | username |
“respawn” | username |
“part” | Path (i.e. game.Workspace) |
“freeze” | username |
“unfreeze” | username |
«add» | username |
«remove» | username |
«kick» | username |
“setuserpermission”, “sup” | userId, permission |
“setgrouprankpermission”, “sgrp” | groupid, rankId, permission |
How this site use cookies
This Platform uses cookies to offer you a better experience, to personalize content, to provide social media features and to analyse the traffic on our site. For further information, including information on how to prevent or manage the use of cookies on this Platform, please refer to our Privacy and Cookie Policy.
Follow the instructions below
HD Admin Commands
Click here to get to the HD Admin command page on the Roblox website. After selecting Get, it should be available in your library. Next, launch Roblox Studio, by navigating to Create and then Start Creating.
Roblox Studio Command Bar
In Roblox Studio, open up your game and select Toolbox.
Here, make sure to select Model, and Admin Commands should show up. Simply click on it to add it to your game. Next, under View select Game Explorer. After selecting it, this explorer window will open up. You should be able to find the HD Admin folder here. Expand the folder, and you will find the settings and custom features files, which allow you to make custom changes to your admin commands on your server.
After publishing the game, you will automatically be set to owner rank, which allows you to use the admin commands on your server.
How To Add Admin Commands To Your Game In Roblox Studio!
Показать панель управления
Комментарии • 102
«It Doesn’t Work» Comments like these clearly haven’t followed the video correctly.
If you have followed it correctly and it doesn’t work then publish the game, where it will work.
@lemon lime What doesn’t work? I need a little more detail than that to help you.
It does not work!
Thats unfortunate to hear. I am also currently without a pc. Sad times.
Oh cause I don’t have a computer and can’t afford (well Idk if I can)
Sorry but Roblox studio isn’t out on mobile unfortunately. I cannot make a tutorial on mobile, i have received this idea before, and yet still i have the same issue.
OMG THANKS SO MUCH THIS REALLY HELPED ME
Great Video This Actually helped me
I did it, but for some reason, I can’t get back to the setting to fix some stuff. Can you help me?
Thanks
Thanks a lot for your help dude!
You’re welcome dude!
Thank you that was helpful
OMG finally a video that actually works!
Glad it works. 😀
I would like to request how to make a game with no scripting knowledge. You probably know all about that.
omg thanks for helping me i will make a admin game with f3x
You’re very welcome!
thank you it worked! 😀
btw can you make a tutorial of how to get the rope command? i rlly want it lol
@Millie Very sorry but i dont think i can make the rope command, it is a bit complex and im not that good at coding/scripting :/
@Millie I’m gonna try my best, if i have to ill get my friend to help me out.
@Voidlet thanks for your help, if you Dont want to u Dont have to
@Millie alright, might be a little tricky to perfet but i can try.
thanks u so much i have search this 1 year
THANK YOU SO MUCH FOR THE VID IMA BE POPLAUR IN MY GAME NOW OMGGGG
How do you get all the commands down? I cant type them all
@Raechelle Legge Do you have a discord so i can help you there?
Voidlet I did it but how do you add multiple admins?
You just insert the admin in your game, there isnt much to type.
OMGGG TY I LOVE YOU SOOO MUCH
I recommend not using HD cause it has been set to were he has owner admin and gets acsess to your game! Yea be destroys the games most of the time
@Voidlet No Problem!
Thanks for telling the people!
OMGG MY SOUL IS MElTED TYSMMMMM MWAH MWAH
nvm i got it to work XD
Well thats great!
can u make the tutorial how to add shop on maps pls
Map with shop icons? or Shop for maps?
Either way, ill do it.
bro i followed u correct and it didnt working
Well you might have to try another tutorial, Sorry.
dont worry Voidlet
I made a rope command for Pokemonhapp2
How do u give 2 ppl owner?
You put their names in the spaces for the admin as shown in the video.
i want to request when i make the freeadmin=3 on everyone when i switch accounts it doesn’t have admin please help
@Voidlet It’s ok my game functions good now it does give moderator to everyone new to game
According to the script the freeadmin command requires numbers. (1-5) So in case you put true there, i would recommend changing it to 5. If that doesnt work be sure to tell me!
but if i can’t can you do it for me
You click on that then you use that thingy and over here you put the thingy on that.
And then you hit that thing and that thing on the thing
Bro how do you even script..
when i clicked settings nothing happend
No u double click settings
You’re also meant to press enter.
didnt work for me pls help
@Tekashi 6ix9ine Did you make sure to follow the entire tutorial properly and followed each everything step-by-step?
Let me know what didn’t work and I’ll get into it.
Have you tries publishing the game and tested it there? Im pretty sure it doesn’t work in studio.
it just doesnt pop up and commands doesnt work why??
How did this not work for you? Did you not follow the tutorial correctly? Let me know what doesnt work about that?
Can you make how to like make a daily reward?
Indeed i can, it will be a video for the future. You will see it uploaded on the second channel.
bruv
i want the smite command
what do you add on the owner because idk
explain your self more i didnt understand anyhting!
Just search “Kohl’s Admin” in the toolbox. Then go to your explorer and then open the Folder named “Kohl Admin” and click and open settings. Then there you can put the people that you want to be banned, have admin, mod, vip etc.
Note: You do not have to add yourself.
P.S You can find the Toolbox and Explorer in the “View” category/tab at the top of your screen.
Hope that helps!
How To Make Custom Admin Commands In Roblox Studio
Показать панель управления
Комментарии • 71
Subbed, liked and turned notifications on 🙂 Keep working hard
Thanks I subbed! and liked it!
It’s great! I also added that if you’re the owner you can use the commands and if not it warns you that you’re not the owner!
local Commands = require(script.Commands)
local prefix = «/»
local Admins = <"YourName","FriendsName">— and so long
game.Players.PlayerAdded:Connect(function(player)
for i = 1, #Admins do
if Admins[i] == player.Name then
player.Chatted:Connect(function(msg)
msg = string.lower(msg)
local split = string.split(msg, » «)
local cmd = split[1]
if cmd:sub(1,1)
= prefix then return end
print(cmd)
if Commands[cmd:sub(2, #cmd)] then
Commands[cmd:sub(2,#cmd)](player, split)
end
end)
end
end
end)
You can do this instead:
@Hanctr_CZ okay thanks
local Commands = require(script.Commands)
local prefix = «!»
game.Players.PlayerAdded:Connect(function
Hey great video! I was wondering if you could do a tutorial on how to make a kick / ban admin command as well? Thanks!
I know how to just add HD admin in your game than done
How do I make a command if I want to erase someones inventory?
Can you please put the script in the desc or the pinned comments?
@Jayhkell oh thanks
You copied this right from alvinblox, give credit at-least.
can you put the script in the desc?
how do u edit your roblox vidoes? can you do a tutorial?
can u send me script where just i have permision on admin
Tysm! THe vid wasnt even long!
How to make more commands??
Hey i wonder if you can make a Benx Command Like :Benx (Playername)
bro can u just make pastebin next time or set the text so we dont have to do it an we can just copy + paste it
@Cheryl Castaneda all fax no printer
you wont learn anything if u just copy and paste the script bruh
BadlyDev + RobloxStudio = subscribed and liked
also congrats im your 30th sub:)
U KEEP DELETING THE ThING WHEN I TYPE IT BRO
Can anyone send me a command script that gives anyone money because i’m making simulater game!
i am your 31st! but uh, how do i add more commands to this? do i put it below the «return commands» or do i put it above it?
above it, because return commmands does it so it repeat so you gotta do above it.
If you add an IF statement allowing only someone to use it, it should work.
you are the best.
congrats im your 40th sub
= preflex then return end
if Commands [cmds : subs (2, #cmd ) ] then
Commands [cmd : subs2, #cmd) ] (plr, split)
end
end)
end)
Thats it and np for telling you also if there are any mistakes please tell me because i dont want people to think that this doesnt work
its actually prefix not preflex
local Commands = require(script.Commands)
local prefix = ‘:’
game.Players.PlayerAdded:Connect (function(plr)
plr.Chatted:Connect(function(msg)
msg = string.lower(msg)
local split = string.split(msg,’ ‘)
local cmd = split[1]
if cmd:sub(1,1)
= prefix then return end
print(cmd)
if Commands[cmd:sub(2,#cmd)] then
Commands[cmd:sub(2,#cmd)](plr,split)
end
end)
end)
I know a way to get admins
do you got an free model or someting?
lol how do you think u will learn from taking free models? lmao
I am your 70th subscriber
Deja vu about have deja vu 0-0
local Commands = require(script.Commands)
local prefix = («:»)
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
msg = string.lower(msg)
local spilt = string.split(msg, ‘ ‘)
local cmd = spilt[1]
if cmd:sub(1,1)
= prefix then return end
print(cmd)
if Commands[cmd:sub(2, #cmd)] then
Commands[cmd:sub(2, #cmd)] (plr,spilt)
end
end)
end)
Kích thước video:
Hiển thị các điều khiển trình phát
NHẬN XÉT • 363
Hi. I’ve learned a lot from your videos! Thank you so much! Can I request for a tutorial on how to put a shoot or fire button for mobile? Thank you and I hope you will notice this. 😊
Really appreciate all these tutorials it helps me understand roblox lua a lot more.
Thank you! This helps so much! I do recommend you put the script into the description to make it easier for us!! Great work!
is this only for admins or can this use everybody?
It’s already there
Your videos are helping me so much, thank you!
Thank you, so much this video was a lot of help, not to long ago a got into scripting and really needed help, and this video was a lot of help
I’m glad you’re back you’re the only good tutorial you tuber I know
Try AlivinBlox he is amazing!!
@Zecta his tourtorials would be good if he did start doing everything at super speed I never understand a thing
extremely underrated, man.
keep up the good tutorials
Works, thank you so much! 🙂 Im subscribing and liking this video.
Hey, I have a problem. So I want these commands to just be for the developers of the game, not literally everyone. How do I do this?
@Cypacic Okay, thanks.
Check the website with the scripts,scroll to the end.
Head to ServerScriptService and add a script to it.
Copy the whole script to it and change ‘Tech_Mike’ to your own name
(Leave ‘Player_1’ there since it’s helpful when testing)
However,there’s a mistake (you can use the find button on top to find the keyword)
Search for ‘PlayerGui’,that’s not an available item/option in the Workspace.
Either change the ‘StarterGui’ name to ‘PlayerGui’ or just change the ‘PlayerGui’ keyword to ‘StarterGui’.
I’m not entirely sure but works for me.
TechMike can correct me if im wrong.
Hope this helps,here’s the link to the scripts.
www.mrmichaelsclass.com/roblox-studio/scripting-examples/admin-commands
Syntax error: Expected ‘End’ (to close ‘function’ at line 9) got ; did you forget to close ‘do’ at line 12?
6 tháng trước +1
This is kinda hard for me to follow when you’re not typing it out. It’s just hard for me to understand what part i’m supposed to type out next when you’re showing the script as it’s already typed out.
Hello,
I wanted to know how can I add Kick, Fly, and Bring commands
.
May I know how?
Amazing tutorial but just one problem, the GUI disappears if you respawn, Any help for this?
Nevermind Krazykai’s Comment helped me
Can you make a admin command that can display text on screen and a fly command
Can you do an video on how to add an Kick command on the frame?
Dude Your videos are soo amazing!
Thank you so much for making this Tutorial
@Tech with Mike how do you add commands
Amazing video like always
Can you make More commands Like: fly or Admin to make Others people Admin with commands and maybe shutdown or godmode Something Like that
I quit roblox Lua C, but when I was learning it, I used your videos :), now I have notifications turned on just so that I can at least like your videos 🙂
Wow that looks really cool :O
How do you make it so it also fits on mobile but doesnt look small on computer
Can you teach me how to make a :age command which tells you the Player’s account age.
THANK YOU SO MUCH.
Hey Nice ved but can you make tutorial for Gamepass dropper or how you made your website
Can you show how to make like anomic admin command bar?
how do you put more of the numbers?
How would you add more commands for the player to use?
Watch the other videos
if i need something and i see your vids, i click instantly
How do u make it so only you can see it in the game with others?(the command bar)
How do you make it so it autocompletes the name? For example if I did /kill timm when the user’s full username is timmothy it kills timmothy
is there a way to make it so only me(the owner) sees it? like in a local script or something
I think the script might have broken due to recent Roblox updates 🙁
It doesn’t say I have an error
Can you make a weapon skill tutorial
how do you make multiple commands?
Tutorial Idea: a gui that if enter a gameid you get teleported there
This didn’t work for me. I did some double checks and it Didn’t. I saw some Mistakes but fixed them.
hey can you show us how to make custom characters to play in
can you make a mobile button?
Like: press the GUI = press [E] on pc.
good video BTW
THIS LOOKS SO COOL
@Tech with Mike Congrats mate :O
@Tamed He DID IT woo
@Kevin just 30 more subs left to go
@Tech with Mike Also you are so close to 5k Congrats 😀
its working but i cant type in the text spot.
Can you copy the whole script and paste it in my replie?
How is no one else in the comments having trouble? I tried to type the same script at 3:23 but it kept saying «Syntax Error» I was excited to finally get some custom admin commands but now im just sad please help.
Can you please make a video on how to make a button teleport you to another game with click detector not a gui just a normal brick part
How i make the command box only show for the owner and admin?
how do i make a flying command with this just wondering
How do I make new commands? I was looking forward to a /m command and a /fly and /unfly command and maybe even a /poop command and even more
a tip:
add another script into ServerScriptService and copy everything in the other script */kill*
and then paste the /kill script into the new script and edit the */kill* to a other command, and edit the other stuff if you know what you’re doing.
just trying to help to make more commands.
My goal was to keep everything on one script and just add to the actions table and create new functions for each new command.
Could you do a fly command
Can you make a tutorial for making it fly?
you can make a admin commands but we can create cmds
Great tutorial, however I do have a few suggestions for improvement:
1. Remove the ‘/’ prefix, we don’t really need it for a text box because the player won’t be chatting regular text in it.
2. Use string.lower() to convert the command to lowercase letters, this is more efficient as it won’t be case sensitive.
3. Instead of just using game.Players:FindFirstChild(«person»), we could instead use:
for _, player in ipairs(Players:GetPlayers()) do
if name:lower() == player.Name:lower():sub(1, #name) then
return true
end
end
What this code does is it converts the name to lowercase letters and it takes all of the player names and converts them to lowercase letters and then it breaks down the name and the player name letter by letter to see if it can find a match, so this is like saying /kill p which will kill Player1 assuming there is no other player who has p as the prefix of their name.
4. Secure the remote event, remote events and remote functions are really vulnerable to exploits and exploiters can easily take advantage of their low security risks in order to fire them and then they pretty much have admin.
5. An easier way to kill the player is player.Character:BreakJoints().
That is pretty much everything I can think of, overall brilliant tutorial 🙂
I have problems with local function do_command(player, actions, person)
if valid_command(action) and valid_player(person) then
if action == ‘kill’ then
kill_player(person)
end
«action» have error.
Thanks, I will take a look and try to incorporate into the next one!
very helpful video can you do a video that adds onto this script that is shutdown server, ban and kick please
@Tech with Mike ok thanks
I have several more videos. I would recommend starting with number 8 as I did a code fix to better accommodate the new requests. You can still watch the others for the general idea, but the code will be slightly different.
Admin Commands: vnclip.net/p/PLB6uqJrVxufsjn2u-aG7MDPTOiXrLhx11
OMG HES BACK. cant wait for new videos!!
So mike one thing to say make a v2 where you can say it in the chat instead.
anyone know how to execute a fly command
or a give admin command
Hey mike ty for this script but can you make it like /give all cash 2000 or like /enemy zombie cause i want to make a zombie game but i also want to spawn zombies to and give cash pls it will help
so remember that gun u made i made it right at the start if the tutorial i made the most buggy gun ever it spawned block it was funny if u used a auto clicker i think i can get the game back if u want to see it use auto clicker 🙂 better if u do u can uh lag the game if u do it right
I like this, but I want it so that I can type the command in the chat and it executes!
Источники информации:
- http://www.techy.how/tutorials/roblox-admin-commands
- http://clip-share.net/video/MtN1iIiPLT0/how-to-add-admin-commands-to-your-game-in-roblox-studio.html
- http://x-vid.net/video/-wFLSMAm57Q/how-to-make-custom-admin-commands-in-roblox-studio.html
- http://vnclip.net/video/UThSP1zaebo/how-to-make-admin-commands-roblox-studio-tutorial.html