Introduction
Hello everyone! I created a simple script that can be used to ban players from your Experience. This script utilizes DataStoreServices to create and save player bans, as well as HTTPService to log that ban to a Discord Webhook.
Instructions
The first thing you will want to do is take the model and place it in ServerScriptService. You can do so here: BanScript
The second thing you are going to want to do is go to your game settings and enable HTTP Requests and Studio Access to API Services. This is a crucial step, failure to do these two things will result in this script not working properly.
After this step is completed, there are some settings you will need to set up in the script itself. These are listed at the very top of the script. With these you can set whether or not you want to log the ban to Discord, and your Discord Webhook url.
How do I use this?
To use the Ban Script, simply require it in a server-side script:
local BanHandler = require(game.ServerScriptService.BanHandler)
From here you will be able to access it’s function for banning a player.
BanHandler.BanPlayer(player)
The parameter passed through this is a Player Object, not a name.
Additions
I welcome suggestions for improvements on this. If you run into any errors, feel free to leave them as a comment and I will address them ASAP. I have also left the code very simple and open so anybody can edit it to their liking. With some simple modifications you could make bans have a duration, or even add a reason as to why they were banned.