Making a Pastebin to Roblox Ban System

Hello I am octa, I’m here to make a simple tutorial on how to ban players from your game by simply adding theyre User ID on a pastebin paste.

REQUIREMENTS:

  • A pastebin account (Free)

FIRST STEP:

  • Go to https://pastebin.com
  • 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.
dsadadaddasd
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
    dsadadaddasd
  • 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)

then there we go :slight_smile:

12 Likes

Nice tutorial, but remember Pastebin has got some request limits, after you reach it, it will ask you to complete a Captcha.

5 Likes

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.

7 Likes

Didn’t know about that but thanks for letting me know!

2 Likes

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.

1 Like

Great idea, except I don’t trust Pastebin with something like a ban database. Granted, I would just make my own service anyways.

3 Likes

This sounds like a terrible idea.

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.

9 Likes

That’s why I’ve resorted to just making my own webserver with NodeJS, super easy to learn and there’s so many hosting options out there.

2 Likes

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.

1 Like

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.

3 Likes

Okay then, in that case, we can do this:

local url = "";
local banned = HttpService:GetAsync(url);
local cooldown = 30;

while wait(cooldown) do
ᅠᅠbanned = HttpService:GetAsync(url);
end;

[NOTE]: HTTP requests should NOT exceed too many requests. It is recommendable to set 15~60 seconds to update.

2 Likes