Admin Console (ALPHA)

I’m fairly new to coding, however, I decided to test my skills and create an admin console!

Link : https://www.roblox.com/library/4803862225/Revelteds-Admin-Console

How it works:

Basically , there is a read-me file stored inside of the free model, but the run down is that you choose the players who you want to spawn in with this in the datastore script. These players will recieve a GUI with 3 options;

  • Temporary ban
  • Permanently ban
  • UnBan

Currently, I only have it so you can only ban the players that are in your server with you, to do so, all you have to do is click the player option which will open a scroll menu of all the players, click the designated player and click the players tab again to close the scroll window, then beside that in the temporary ban option, you can set the amount of hours the player is banned for ( also going to work on setting days up in the future) then click submit and bing bang boom the player has been hit the the ban hammer >:)
To unban a player, simply copy and paste their id in the “UnBan” slot, and hit submit.

Questions:

Help! I banned myself D:!!
Don’t worry! it’s not the end of the world! if you follow the instructions given in the read me, you can edit the datastore key and unban yourself manually C:

“X” doesn’t work, how often will you be updating this?
As often as I can!! I do not have an asset loader for this yet , so You may have to re-add the model!

What are some planned future updates?

I plan on doing the following:

  • Adding a userId box so that you can ban players that are not located in your server

  • Adding different time increments

  • Making it so no one can ban the owner of the game

and hopefully a better UI layout!

Feedback is muchly appreciated, a lot of highly skilled programmers may cringe when they look in the actual script (Sorry in advance :P) but to my knowledge, all the tools in this model work and have been tested :slight_smile:

Enjoy!

EDIT: Just realized I had an error since I changed the name of something, I think I fixed it now! (SORRY!!!)

14 Likes

It’s a well developed script for being fairly new to coding. The only thing you need to work on is the UI itself. It’s pretty basic and the buttons and textboxes are unaligned and the spacing is uneven.

3 Likes

Thanks! And yea, I just kind of threw it together and focused on the coding, ill change up the UI a lot later when im at a more comfortable spot with the coding!

So, this is a decent way to get into scripting, but there are a few things to keep into account.

Starting off, your ban code suffers from a data sharing issue. You have a “default” BanData variable you apply to all new players, which is not good. Since you aren’t creating a new table, here’s what can happen.

  1. I join for the first time, so the BanData table is reference in my data.
  2. I get banned, for whatever reason, permanently.
  3. Some new player joins the game, so they get the same BanData I had applied to them.
  4. They’re now automatically banned, because the default table is shared by all new players.

You can fix this by just making a function that creates new BanData every time you call it, or instead just initialize the table inside the PlayerAdded event. Also, you call GetAsync twice in a row when you could’ve just cached the result from the first call.

You also set to the datastore when players leave, which isn’t needed, because you already set to it when they are banned or unbanned.

Now, there’s also a fatal security flaw: you do no server checks to see who is banning who. You use the “key verification” where you just do if key == "Key" on the server, which is completely insecure. You should instead be checking if the player that called the remote is in your admins’ list. As it is right now, anyone with an exploit can ban anyone in your game.

Another thing I noticed is what your banning does; you set the datastore of the player that called the remote, not the player that was supposedly banned. I assume this isn’t expected behavior because this would be banning yourself.

Other than that, there’s only small formatting issues and minor things like where to use pairs vs ipairs.

8 Likes

Thats quite helpful, ill have to take a look at all that, though there are a couple things;

  1. I’m pretty sure I dont save it to the admins datastore, I save it to the player who got banned’s datastore so it should only ban them, and i tested this with my friend and it worked, but ill look into it again ofc

  2. for ban data, i thought that if I do :GetAsync(userId)or BanData that that would give only new players the BanData stats and give everyone else their appropriate stats?

Anyways thanks a bunch for the feedback ill definitely look into some of these issues

1 Like