Your idea is good, however it would just last in one server. DataStore is one of the only ways to save ban logs, ensuring that players can no longer rejoin the entire game, rather than just a single server.
Personally, I like to set up my ban systems with DataStore. I typically use the same data store that handles all player data. Within the data that is stored, I use tables, of course, and inside I do the following:
local ExamplePlayerData = {
Banned = {false,nil,nil,nil,nil}
-- Other data variables
}
The first bool value you see, represents if the player is banned or not. It should default at false, unless you have a premade ban list featuring players who have yet to play the game. I am sure you can figure all that out.
Regardless of order, the remaining four values represent: Ban reason, admin who banned, time banned, and time when they become unbanned.
Now, I set the values based off of what the admin inputs. I have a system in my game where it translates a string to a value of time. For example, “2d” = 2 days, “8h” = 8 hours, and so on and so forth. Using this value, the ban time is set to tick(), and the unban time is set to tick() plus the time that was calculated (in seconds).
Once the data is set, the player should be kicked from the game, with the message stating: "Kicked by “…AdminName (set up with the saved values)… " for “…Reason (again, link to values)…”.”
Every time a player joins my game, it first checks if they are banned. If the first value is set to false, then it passes through and loads data as normal. However, if it is set to true, it scans the second, thrid, fourth, and fifth values. It checks if the current time os.time() is greater (>) than the unban time. If so, it resets the data, defaulting at {false,nil,nil,nil,nil}. If the time has not yet passed, it kicks them again with the same message as stated before.
Why go to this length would you ask? Well, you could always use free admin sources in your game. HD admin is one of the better. However, I prefer my own code, preventing random commands from being enabled into my games. With this system, you can set how long a player is banned and state a reason.
This system is not necessarily simple by any means, however it is very effective and has lots of customization features included.
Thanks for reading. I hope this helps. Have a great day!