Ban List

Ban players from your Roblox game.

by TypicallyPacific

Author Avatar

ROBLOX BAN LIST

By TypicallyPacific

====================================================================

Do you need to ban certain players from your Roblox game? Then follow the steps below to create an easy to edit ban list.

STEP 1: CREATING A BAN LIST First, create a normal script and put it in ServerScriptService. To make it easy to edit people who are banned from your Roblox game, we are going to create table that contains all the User IDs of banned players.

To do this, we're going to have to create a table and assign it to a variable, in this case, banned. Now we're going to list all the IDs of the banned players. We're using IDs instead of names that way if they change their name, they will still be banned. List all the IDs between the brackets like in the example below.

local banned = {ID, ID, ID}

STEP 2: CHECKING IF A PLAYER IS BANNED AND KICKING THEM When a player joins, we need to check if they are banned from the game. First, we need to know when a player joins by using the PlayerAdded function. To do this, under the banned variable, type game.Players.PlayerAdded:Connect(function(plr). Plr is the user that joined the game.

Now we need to loop through the banned table using a for loop. To do this, use the line for i,v in pairs(banned) do and that will loop through all the IDs in the banned table. Then we're going to use an if statement to check if the player who joined UserId is one of the UserIds in the table. If they are in the table, it will kick them from the game for the reason "Banned".

local banned = {ID, ID, ID}

game.Players.PlayerAdded:Connect(function(plr)
    for i,v in pairs(banned) do
        if plr.UserId == v then
            plr:Kick("Banned")
        end
    end
end)

View in-game to comment, award, and more!