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 10 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
10 years ago

Use the Kick method.

local PlayersWhichCanPlay = {masterhalo55 = true, 
jobro13 = true}

game.Players.PlayerAdded:connect(function(Player)
if not PlayersWhichCanPlay[Player.Name] then
    wait(3)
    Player:Kick()
end
end)
Ad
Log in to vote
1
Answered by
trogyssy 221 Moderation Voter
10 years ago

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

local people={"trogyssy", "masterhalo55"}
Game.Players.PlayerAdded:connect(function(p) 
local kick=true
for i=1, #people do
if p.Name==people[i] then kick=false end
if kick=true then p:Kick()
end
end)
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 — 10y
1
But aren't names strings? trogyssy 221 — 10y

Answer this question