Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

2 comments

0

Thanks, I am new to the pairs, in pairs, and ipairs, Thank You! :D

0

No problem. Contact me anytime if you need anymore help or advice!

This discussion is preserved as it was. New answers, comments, and votes are closed.