I need help with creating my own banlist script

Hello everyone, I’m writing this post as I’m trying to achieve the goal of creating my own Roblox ban list script, I want this to be a plugin everyone can use to ban known trollers, exploiters and scammers but I’ve tried working on it and I have no idea how to make it work. I’ve tried to use DevHub for some of this but I don’t have much of an idea of what I’m doing. Here is my script:

local Players = game:GetService("Players")
local banlist = {
	'John Doe',
	'Jane Doe'
}

local function playerjoined(player)
	local plrtokick = Players:FindFirstChild(name)
	if Players:FindFirstChild(name) = banlist then
		plrtokick:Kick('You have been banned from this game for either: exploiting, scamming or trolling.' ..
			'Any alternate accounts will be banned as well.' ..
			..
			"Powered by GamersInternational's Ban List")
	end
end

Players.PlayerAdded:Connect('playerjoined')

Thank you to everyone who tries to help.

I’ve listed what I think is related errors below:

image

In the if statement youll need to use == instead of =. But then it still wont work. Create a loop trough the banlist and check every name in there.

I’ve done that but now it’s having some errors on doing the multi-line kick message.

image

Try This

local banList = {"John","John"}

game.Players.PlayerAdded:Connect(function(player)
	for i, v in pairs(banList) do
		if player.Name == v then
			-- Kick
		end
	end
end)

To create new lines in kick messages, … You need to use \n which is the sequence for a new line.

I thought … would work as well. I know \n does work but I didn’t want the script to be that wide to see.

1 Like

With these things [[ ]] you can create a string in the code window with multiple lines. Just search it up :wink:

Okay some things I want to state out, Use the players UserId instead of the name. They can just change there name.


local BanList = {
   -- Someone you dislikes UserId for example

   111
}

local function playerjoined(player)
       for i,v in pairs(banlist) do -- Doing a loop through the banlist
          local success, err = pcall(function() -- If it fails returns "Player isn't on the banlist!"
                 if player.UserId == v then -- Checks if the userid is on the banlist
                      player:Kick("Power by GameInternational's antiexploit") -- Kicks player.
                 else
                        print("Player isn't on the banlist!") -- Player isn't on the banlist msg
               end
         end)
   end 
end

game.Players.PlayerAdded:Connect(playerjoined) -- Use connect to connect a local function

I’ve just tested this and it looks to be working, thank you. I’m planning to make the project open-source and regularly updated.

1 Like

Always Looking To Improve The Community.

1 Like

Want to point out that he just scripted what i explained in the 1st reply… Didnt want you to just copy and paste any code. This isnt the right way to learn.

Hmmm that is true. I’m pretty sure your not meant to give people whole scripts. I’m still thankful though.

1 Like

I’ve put comments in my script to help you understand better.

If you also want this to be effective and people to use you’re banlist script then I suggest using UserId’s, People can just change there names.

I will use UserID’s on it, just configuring the install script so people do get automatic updates.

Big oof @thosenamesaregood and @HackItsGood, the install script doesn’t work because it’s not a modulescript. We’ll have to stick with serversided for now.

1 Like

Adding to what @HackItsGood said, you can actually just use table.find() instead of a for loop

local banList = {"John","John"}

game.Players.PlayerAdded:Connect(function(player)
   if table.find(banList, player.Name) then
      player:Kick("Reason")
   end
end)

I’m going to test that out now, thanks for adding on to what he said.

Just to add to it, you should always use the UserId instead of Name, Name can be changed, UserId cannot. Use UserID for anything that sticks with a player, dataStores, banLists, etc.

So you should actually change it to

local banList = {12309,1764863}

game.Players.PlayerAdded:Connect(function(player)
   if table.find(banList, player.UserId) then
      player:Kick("Reason")
   end
end)
1 Like

I’ve decided to do that. It also seems to work in a module so I can publish the installer script now :smiley:

Changed solution to yours as it is better.

As it works now, here is the links to the models if you want to use them. Will be writing a page in resources for this tool soon.

Installer: GamersInternational's Ban List - Roblox
Module: Banlist Script - Roblox

Source: Release Version 1.000 [29/12/2020] · ExperiencersInternational/GamersInternationalsBanList · GitHub