Create a pastebin account (Important so you can edit your paste and add new User IDs on it)
Once you have created your pastebin account then this is how you format your paste
032334213123;3020301303001323;32333300233103;
You basically just separate the user IDs with a ;
STEP 2
Publish your paste
How do I edit it?
If you published your paste using your account you should see this.
then click edit
ROBLOX
STEP 1
Create a baseplate in roblox studio
Publish the baseplate
Go to game settings > security then turn on HttpService
Create a script in ServerScriptService
Then paste this code
local url = "https://pastebin.com/raw/StXHHzt1"
local http = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(plr)
local data = http:GetAsync(url)
local bans = string.split(data, ";")
if table.find(bans, tostring(plr.UserId)) then
plr:Kick("Banned")
end
end)
Hold on were not done!
2ND STEP:
Go back to your paste
Go click “raw”
After you click it then it should take you to a new page
Copy the URL!
Go back to your Roblox Script
local url = "paste your copied url here"
local http = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(plr)
local data = http:GetAsync(url)
local bans = string.split(data, ";")
if table.find(bans, tostring(plr.UserId)) then
plr:Kick("Banned")
end
end)
Instead of loading every time, save a cache on the server via a variable and read it from there. It would save resources from requesting the website. Only refresh every once and then.
But if we do it in reverse, we would have something like this:
When a player joins, we get the paste again. So that updates itself, making it so the developer can update their paste every time someone joins the game.
DISADVANTAGE
After so many requests, the script could probably give us a Captcha, or give us an HTTPError.
Just host a database? It’s the same issue with all the awful Trello APIs out there; making something that isn’t a database into a database always ends poorly.
As someone who used this method primarily for a ban system, I constantly found myself looking for an alternative; Pastebin would often reject the API requests I rarely sent. Other options such as the one unix suggested or simply using datastores may prove more reliable.
I do not suggest using Pastebin for large projects/games.
I do not intend to use PlayerAdded event to register that. Use a regular timed loop that keeps it updated about every other minute or longer. The issue is that this fires a high number of times due to high player joins and it can be problematic for the server if the HTTP suddenly stops you from sending more requests.