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

How to make a ban script using tables?

Asked by 4 years ago

Hello! I was wondering if anyone knows how to make a ban script using tables.

This is currently what i've got.

local name = {"Aiden_12114", "Amanda69"}

game.Players.PlayerAdded:Connect(function(player)
    if player.Name == name then
        player:Kick()
    end
end)

0
Review how tables work. This will only be a temp bad for that one server only. Look at using a datastore to ban players across the game itself User#5423 17 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

kingdom5 is wrong because that script is in every server and if its not im stupid and kingom5 is right.

local name = {"Aiden_12114", "Amanda69"}--banned people

game.Players.PlayerAdded:Connect(function(player)
    for i, v in pairs(name) do--looping through the names
        if v:lower() == player.Name:lower() then --:lower() makes all the letters lowercase
            player:Kick("Your banned!")
        end
    end
end)--Also they can just switch their name and then it wouldn't work so I'd recommend looking into UserId

If you do want commands for it then listen to kingdom5. You'll need to save tables in datastore with the people that are banned but if ur not bothered about it and will change it in studio (which is fine but I'd prefer commands).

0
Thanks! Aiden_12114 79 — 4y
Ad

Answer this question