Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by
Rinextel 291 Moderation Voter
5 years ago
Edited 5 years ago

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

Log in to vote
2
Answered by
valchip 789 Moderation Voter
5 years ago
Edited 5 years ago

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)

0
Btw, they can still change their userid if the script is client sided. 3ora 54 — 5y
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. valchip 789 — 5y
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. 3ora 54 — 5y
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. valchip 789 — 5y
View all comments (4 more)
1
That's literally what I just said. Plus, exploits can bypass locked properties as they have access to a full lua environment. 3ora 54 — 5y
0
No. User#19524 175 — 5y
0
Plus if the script is server sided it wouldn't have effect :xdd: User#19524 175 — 5y
0
Thats what i said 3 times. 3ora 54 — 5y
Ad
Log in to vote
1
Answered by
3ora 54
5 years ago

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.

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. valchip 789 — 5y
0
It's supposed to run everytime someone joins. Everytime someone joins, it checks for the player name "Rinextel" then kicks that player. 3ora 54 — 5y
0
It DOES NOT check if the player's name is "Rinextel". There is no if statement which does that. valchip 789 — 5y
Log in to vote
0
Answered by
gullet 471 Moderation Voter
5 years ago

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

0
This is what I am getting http://prntscr.com/l5r8ke Rinextel 291 — 5y
0
It's because you're missing an end. Why the downvote? gullet 471 — 5y
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, valchip 789 — 5y
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. gullet 471 — 5y
0
No. valchip 789 — 5y

Answer this question