Introducing Crrustban!

Hello there Robloxians!

Now, some of your games may need protection, and for example, if you don’t like someone, you can just kick them when they join a game!

I present to you…

Crrustban!!

Yes, these scripts kick players from your game, if they have a specific name, id or account age.

1) Account name

Alright, you wanna ban someone if they have a certain name? Well, follow me!

So, first thing you wanna do is insert a Script into ServerScriptService and call it whatever you want, like Name for example. Now, you want to create a list of the names you want to keep out, so let’s do that!

local bannedNames = {
"Crrustyy",
"MightyBloxMason",
"Builderman"
}

These names can be whatever you want them to be, whoever you wanna keep out.

We can also write a pre-written message, like this:

local message = "Sorry, you aren't allowed here!" 

This will popup when it kicks them.

Now, we want to check if a player has these names, so we write:

game.Players.PlayerAdded:Connect(function(playerJoined)
for i, v in pairs(bannedNames) do
if player.Name == v then
player:Kick(message) -- Kicking them, whilst showing the message
    end
 end
end)

Well, that basically kicks them if they have a certain name, but what if they change their name? You may want it to kick them no matter what if they change their name or not. So, moving on to

2) UserId Banning

So, again, this will involve a Script in ServerScriptService , and including the following,

local bannedID = {
1268610732, -- Me
205576167, -- MightyBloxMason
1 -- Roblox
}

We can also include the message,

local message = "Sorry, you aren't allowed in here!"

We can now link this when the player joins the game!

game.Players.PlayerAdded:Connect(function(playerWhoJoined)
for i,v in pairs(bannedID) do
if playerWhoJoined.UserId == v then
playerWhoJoined:Kick(message)
 end
end
end)

This is more efficient than the player’s name, since they cannot change their ID.
But what if you wanted to kick them based on their account age? You don’t want bots in, do you? Alts? No, I wouldn’t :slight_smile:

Account age scripts are found in the model

Well, that is all there is to it! Change the Names, ID's and the account age to what you think feels right!

Here is the model for Crrustban:
https://www.roblox.com/catalog/5065544805/Crrustban

Feel free to reply with anything you want to add on, if there Is a better way of doing it, or just your views on it!

Many thanks,
Crrustyy

10 Likes

This is my first actual model, so there is a lot to improve!

Updates are being worked on!

Nice tutorial. One thing though:

That is in the PlayerAdded event, I don’t think you need to check if that is a player since… you know what I mean.

4 Likes

Understood, just saw this a while back, and thought it was something more efficient :wink:

Kicking players based on their username is pointless because usernames can be changed.

if playerWhoJoined.UserId == bannedID[1] then
You are only checking if the player id matches the first element in the bannedID array. In your example, players with the userId 205576167 and 1 are not kicked even though they are on the kick list.

if playerJoined:IsA("Player") then
You do not need to check for this.

4 Likes

Yeah, and that’s why I provided 2 examples on how to do it.

Thanks for pointing this out, im fixing it right now

Updated it to be fully functional, so thank you!

The Username banning/kicking would be for trolls/jokes on friends really, but the ID is more of a serious one.

Thanks for sharing interest and ideas!

Yes, I agree, however while I am actively seeking better ways to handle bots etc…, this is good enough until then.

Very true, very true.

1 Like
for i,v in pairs(bannedID) do
game.Players.PlayerAdded:Connect(function(playerWhoJoined)

For every player on the list, you are creating a PlayerAdded connection. You have the right idea, but the for loop is in the wrong place.

2 Likes

slaps forehead

Well isn’t that silly of me?!
Wow, me need to kick me out of my game now…

Thanks, you have been most helpful!

2 Likes

if a player’s account is younger than 10 days, why don’t you just make a GUI where they have to put in a number, or a string to prove they are not a bot.

thats pretty cool

30charecters

Thank you!

As previously mentioned, I am making major improvements right now, such as what @twichman123 suggested.

You can use table.find instead of looping through each ID in the banlist.
if table.find(bannedID,playerWhoJoined.UserId) then

1 Like

A number of points I’ve observed from your code:

Age limits: These are against the Terms of Service. Kicking people for having different UpperTorso and UpperRightArm brick colour is… odd and not effective; but you’re still using age limits.

Additionally, your code has a number of anti-patterns; including indexing services (use GetService!), as well as unclear variables, unusual indentation, and race conditions.

1 Like

Oops, the brick color was accidental, I was testing something out in studio, and forgot about it. Don’t worry, no racial conditions are taking place.

Yeah, that was for my minigame, but was testing it out in my other studio haha
(basically, if they get infected something happens to their skin and yeah)

UPDATE: Version 0.2.0

Users with low account age now have to go into 2 step verification! (W.I.P)

1 Like

Unless I am blind, restricting access to users below a certain account age is not against the ToS. Raising a veterancy status as being above others or discriminating someone according to their real age is an offense, but not allowing someone access to a certain feature depending on whether their account is above a certain limit of a few weeks should be alright, I even noticed a few front page games implementing it as a security measure when I was playing on an alt (though it was about 2 months ago).

This doesn’t mean everyone should go ahead and do this though. You should provide a system to send players to a different server in case they don’t fulfill the requirements or were banned. You should also implement a fail-safe where a player gets sent to an empty place before getting kicked. Some server crashing exploits were countered multiple times this way.

How would you implement this? Offer a config module with blank strings included by default. If the string is equal to "", then do whatever you want to do directly; otherwise, teleport the player to the provided place.

2 Likes

yes but this function is used to stop Bots from joining games, plus it just asks the players to do a 2FA to make sure they are really human

Shouldn’t this go in #resources:community-tutorials ?