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

How can i kick all players with Game.Players?

How do i kick players like if they step on a brick lets say they step on a brick is there a way to get the players without writing it down?

Game.Players.(PlayerName):Kick("Sorry You've Been Kicked")

1 comment

0

You are sending some mixed messages here, do you want to kick everyone or just the person who touched the part?

1 answer

For first, the Game is deprecated use game

You need to get all players with for

You can see here: Roblox Wiki - for

Example:

local table = {"Apple","Orange"}
for i,v in pairs(table) do
	print(v)
end

You can simple use:

for i,v in pairs(game.Players:GetPlayers()) do
	v:Kick("Sorry You've Been Kicked!")
end

Hope it helped!

3 comments

0

That's not called "pairs", it's a generic for loop. Please use the correct terminology if you will answer a question.

0

Thank you. I did not know much about how to explain this up because I forgot to put on the for and the pairs had nothing to do with. I just knew how to use.

0

Don't need parentheses around "loop".

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