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

How can i kick all players with Game.Players?

Asked by 5 years ago

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")
0
You are sending some mixed messages here, do you want to kick everyone or just the person who touched the part? theking48989987 2147 — 5y

1 answer

Log in to vote
0
Answered by
yHasteeD 1819 Moderation Voter
5 years ago
Edited 5 years ago

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!

0
That's not called "pairs", it's a generic for loop. Please use the correct terminology if you will answer a question. User#19524 175 — 5y
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. yHasteeD 1819 — 5y
0
Don't need parentheses around "loop". Shawnyg 4330 — 5y
Ad

Answer this question