Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script not working and is not kicking users? [ANSWERED]

So, I have created a script that kicks people according to their name, however, the script is not working and is allowing the person to play.

Here is Script

function BanCheck()
	game:GetService('Players').PlayerAdded:Connect(function(player)
		local plrNAME = player.Name 
		if plrNAME == "Rinextel"
			then plr:Kick("You are banned from this game")

	end)
end
	
BanCheck()
	

3 answers

✓ Accepted answer

The way you are doing that is wrong, try out this. Also ban players by their ids because they can easily evade their ban by changing their username, but they can not change their user id. Except all of that the way that the ends are placed is wrong.

local banlist = {1, 2, 3, 683844231} --Ids of the players which you want banned.

game:GetService('Players').PlayerAdded:Connect(function(player)
	for i, v in pairs (banlist) do
		if player.UserId == v then
			player:Kick("You are banned from the game")
		end
	end
end)

8 comments

0

Btw, they can still change their userid if the script is client sided.

0

No, the user id of the player is a locked property and it can't be accessed by the client or server. But either way you want your script to be server sided.

0

I know, but what I am saying is that.: If an exploiter, joined they may change their userid/name using an exploit. but it would not replicate to the server so the kick script would have to be client sided for the exploit to work.

0

^ As I said, the player's user id and the name is a locked property, if you tried changing it would simply error. Also even if that was possible the client wouldn't replicate to the server.

1

That's literally what I just said. Plus, exploits can bypass locked properties as they have access to a full lua environment.

0

No.

0

Plus if the script is server sided it wouldn't have effect :xdd:

0

Thats what i said 3 times.

So this would not work because you have it as a function, the function is only being called once. With this script, it checks it whenever a new player joins the server. So if "Rinextel" joined the server, the script would react with: game.Players.Rinextel:Kick("You have been banned from this game!")

game.Players.PlayerAdded:Connect(function(player)
	game.Players.Rinextel:Kick("You have been banned from this game!")
end)

Please say if there are any errors in this as i wrote this off the bat.

3 comments

0

If no one in the game was called "Rinextel" the script would error and it would run everytime a new player joined the game which is stupid.

0

It's supposed to run everytime someone joins. Everytime someone joins, it checks for the player name "Rinextel" then kicks that player.

0

It DOES NOT check if the player's name is "Rinextel". There is no if statement which does that.

Check your errors in output, seems like you're missing an end.

5 comments

0

This is what I am getting http://prntscr.com/l5r8ke

0

It's because you're missing an end. Why the downvote?

0

He is not just missing an end, the way that the ends are placed is wrong too so adding an end to it will do nothing, this answer is incorrect,

0

The only technical errors are the end missing on line 6 and the different variable names of player and plr. But the end would be the first error he gets which he should provide.

0

No.

This discussion is preserved as it was. New answers, comments, and votes are closed.