How to make a ban script | Guide

HOW TO MAKE A GOOD BAN SCRIPT


How do I make an advanced ban script?

It is very easy! Let me show you how to make it!

First you need to make a script! Script Logo

You can name it anything you want! :smiley:

Then you need to open the script and write this!

local blacklisted = {["USERNAME"] = true}

game.Players.PlayerAdded:Connect(function(plr)
	if blacklisted[plr.Name] then 
		plr:Kick "REASON"
	end
end)

USERNAME = Put the username you want to ban. NOT DISPLAY NAME
REASON = Put the reason for banning the player.

It must look like this!
Script Example

Then make sure to put it at Server Script Service!

I hope I helped you! Make sure to :heart: and comment! :grinning_face_with_smiling_eyes:

13 Likes

The player’s Id should be used instead of the name since that can be changed. Also with this script you have to manually put in all the banned players, which is fine, though it’s not ideal. Instead you can have a data store of banned user id’s and use the same principle where when the player joins the script checks if the player is banned or not and kicks them if they are. Then to ban someone you can add their Id to the data store via a script, which is easier than doing it manually.

4 Likes

Here’s my feedback:

  • I wouldn’t really consider this an advanced tutorial. You would only need to use this if you only want to ban specific players.

  • You should put the player’s ID instead of Username in the blacklist table because the banned player could just change their username to unban themself.

1 Like

there are several topics about this, however this seems to be the most efficient

Maybe make some name to userid converter? To be more different than other tutors

Thats a impressive tutorial but:

I do not understand what each script does.

i could dm you what each line does

Why do we need to find the userid from the name when we can get their userid directly?

1 Like

Sometimes were lazy to copy user IDs so a name to userid converter would work

Also it’s kind of tedious to go to the website and search his name each time…

1 Like