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

How to make a script that kicks all players that enter the game except certain people can enter it?

Asked by 11 years ago

I need to know how to make a script that does that but certain people can lay and not get kicked?

2 answers

Log in to vote
2
Answered by
jobro13 980 Moderation Voter
11 years ago

Use the Kick method.

1local PlayersWhichCanPlay = {masterhalo55 = true,
2jobro13 = true}
3 
4game.Players.PlayerAdded:connect(function(Player)
5if not PlayersWhichCanPlay[Player.Name] then
6    wait(3)
7    Player:Kick()
8end
9end)
Ad
Log in to vote
1
Answered by
trogyssy 221 Moderation Voter
11 years ago

That won't work. (Correct me with proof if I'm wrong)

1local people={"trogyssy", "masterhalo55"}
2Game.Players.PlayerAdded:connect(function(p)
3local kick=true
4for i=1, #people do
5if p.Name==people[i] then kick=false end
6if kick=true then p:Kick()
7end
8end)
0
Jobro's works, there is no reason it wouldn't. The table is setup correctly (other than for usernames that start with numbers, such as mine), if that's what you're getting at. User#2 0 — 11y
1
But aren't names strings? trogyssy 221 — 11y

Answer this question