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

[SOLVED] Why doesn't this "in pairs" ban script work?

Asked by
IcyEvil 260 Moderation Voter
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Im trying to make a Ban script and, I need to know why this doesnt Work.

bans = {"Player1"}-- add onto

-- Don't touch any of this unless you know what you are doing.
for i,v in pairs(game.Players:GetPlayers(bans)) do
    v:remove()
end

1 answer

Log in to vote
1
Answered by
Dominical 215 Moderation Voter
10 years ago

This doesn't work because the player isn't even in the game yet. Use this instead: You also didn't use tables correctly.

bans = {"Player1"}

game.Players.PlayerAdded:connect(function(player)
for i,v in pairs(bans) do
if player.Name==v then
player:Kick()
end
end
end)
0
Thanks, I am new to the pairs, in pairs, and ipairs, Thank You! :D IcyEvil 260 — 10y
0
No problem. Contact me anytime if you need anymore help or advice! Dominical 215 — 10y
Ad

Answer this question