How to make an admin panel?

How do I make an admin panel that has the following: ban or kick players and change player’s stats.

2 Likes

For banning players, you will want to make a Gui that of course has a ban player button, TextBox for the players username, and a possible image label to get the profile image of the user being typed in (Using Player:GetUserThumbnailAsync() ). When the ban button is clicked you would verify that the Name is a vaild roblox player. And you would run a kick if the player is in the server (Optional: See Global System below to learn how to hook this with a global System with kicking a player). Then you will want to use DataStoreService to hook up the infromation in a ban (You should use the USERID in datastores and not the name! People can change their name). If the player rejoins, you check this datastore, and if they are in the list of the data store, you kick them again. If you have a reason system you might wanna save it like the following:

local ExampleBannedList = {
--43543166 and 68656862 would be the USERIDs and the " " is the reason why
[43543166] = "Banned for flying",
[68656862] = "Banned for inf money exploit",}

For server kicking… Just see if they are in server, and kick them if they are. The different with banning is you would not save this in a DataStore! (Optional: See Global System below to learn how to hook this with a global System with kicking a player)

Assuming that you have the set up, theres different ways to do this. You would have 2 TextBoxes atleast, and probably buttons with each stat you want to change. Assuming you have one folder, with all the stats like money, and run a whole lot of verified checks (Like checking in the inputs of the textboxes exist and valid) . you would Then Connect a remote event and tell the server, what stat the change, the new value, and who to give it to.

Everything I just said above has to be connected with remote events/functions so it can run to the server for data saving and kicking!!

To make a hidden Gui: For adding Admins, make a list of UserIDs, and add the people you want. Check this list on join, and if they are in this list, Enable the Gui. If they aren’t, Destroy the Gui.

Optional Global System: If you use the current method above, Its works mostly on the server that a valid moderater is in that ran the command. Like kicking the player action, will not work if you are the person wanting to kick are in different servers! This is where MessagingService can help us! Messaging service allows us to communicate to other servers and give them information. Understand Messaging Service is not guaranteed but a best effort deal. Assuming you respect the limitations of Messaging service. You can allow for Global Stats Giving and Global kicking (Wether that is for the kicking action, or for banning a player and kicking them for the first time). Basically you would want to connect The players name, The action, And anything else (Amount of stats, Kicking/Banning reason). You would send a signal to the servers and give them this info, and decode it, and preform the actions in the server that has the wanted player active in.

~Hope this helps! Feel free to ask any questions!

5 Likes

I have a question, for the ban system could I just make a list of banned players and then a function that kicks the player upon joining if they are in that list?

2 Likes

That is what you would do in a datastore yes. You would add someone to the list inside the datastore and save it.

4 Likes