I am trying to make a ban admin command so an admin could type out :ban user and then it would kick them from the server and if they try to rejoin, they will get kicked. I don’t want to make it a permanent ban so I am trying to avoid using data stores.
I know how to sort the player id for the banned players, but how would I tie on a ban reason so the admin could type out :ban user for hacking and it would tie that reason onto that selected player in a table for example?
I have searched through the dev forum but I can’t find anything related to this, if you have any questions, I can elaborate.
To do this, if you want to make it for a specific server, make a datastore and set the player to ban with a key like "ServerBan_"..game.JobId for the specific and set the key to true when you make the ban and when the player joins, check if their key (using GetAsync) is true and than kick them, likewise for PermBan on all servers, just make a key (PermBan) and set it to true with ban command and get the key when the player joins and check if they are banned (the key is true) and than kick them, for timed bans, make an os.time() for the time to be banned for and set the key to true, and set it back to false when the time is greater than or equal to the time to get unbanned
Add a folder and insert values containing the names of the banned players? Then loop through when someone joins and check if they match the ban. This is server-specific, doesn’t use data stores and I find it is a little bit easier to understand than tables. Use for i, v in pairs(folder:GetChilren()) do if v.Value == (PlayerID) —kick player end end