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

Help with ban script?

Asked by 10 years ago
local banland={"xMegs"}

game.Players.PlayerAdded:connect(function(newPlayer)
    if banland then
        banland:Kick()
    end
end)

I got stuck on the if statement. Any help?

3 answers

Log in to vote
0
Answered by 10 years ago
local banland={"xMegs"}

game.Players.PlayerAdded:connect(function(newPlayer)
    if newPlayer.Name==banland then
        newPlayer:Kick()
    end
end)


Ad
Log in to vote
0
Answered by 10 years ago

Sorry if this doesn't work

wait(0)
local banland={"xMegs"}
game:service("Players").PlayerAdded:connect(function(plr)
for i=1,#banland do
if plr.Name:lower()== banland[i]:lower() then
plr:Kick()
end end end)
Log in to vote
0
Answered by
ked2000 15
10 years ago
local banland={"xMegs"}

game.Players.PlayerAdded:connect(function(newPlayer)
    for _, list in pairs(banland) do --Iterates through banland.
        if newPlayer.Name:lower() == list:lower() then --Checks if name is equal to a string in banland
            newPlayer:Kick() --Kicks player
        end
    end
end)

Answer this question