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

Why is this ban script not working?

Asked by 10 years ago

So I have a script that is supposed to ban certain players upon joining. I used my alt as one of the people banned, and the script did nothing when I had my alt join the game.

I also tried to test the script in Test Mode, and output gave me nothing.

I have no idea why this script is not working. Can someone please help me?

Here's the script:

01BannedPlayers = {"Player1", "Player3"}
02 
03game.Players.PlayerAdded:connect(function(Player)
04    repeat wait(1) until Player.Character
05    for k,v in pairs(BannedPlayers) do
06        if Player.Name == v then
07            Player:Destory()
08        end
09        end
10end)
0
Instead of using repeat wait until, you can use the character added event also. You can also use the Kick function to make their game shut down. EzraNehemiah_TF2 3552 — 10y

1 answer

Log in to vote
4
Answered by 10 years ago

You misspelled Destroy.

01BannedPlayers = {"Player1", "Player3"}
02 
03game.Players.PlayerAdded:connect(function(Player)
04    repeat wait(1) until Player.Character
05    for i,v in pairs(BannedPlayers) do
06        if Player.Name == v then
07            Player:Destroy()
08        end
09        end
10end)
0
I feel really stupid... How did I not notice that? Either way, it's fixed. Thank you. CoolJohnnyboy 121 — 10y
Ad

Answer this question