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

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

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

2 answers

✓ Accepted answer

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)

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)

2 comments

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.

1

But aren't names strings?

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