I dont know how to kick all players from the server at the same time.
My script that i tried:
local players = game.Players:GetChildren()
players:Kick("idk")
I dont know how to kick all players from the server at the same time.
My script that i tried:
local players = game.Players:GetChildren()
players:Kick("idk")
just loop through all the players
for _, Player in ipairs(game.Players:GetPlayers()) do
Player:Kick("idk")
end
That’s pretty close, but in coding, “all of the players” can’t be represented in a single variable, which is why tables exist. Arrays are basically just lots of strings and numbers and variables that are cased together under one variable using {}. Dictionaries are the same but use strings for each spot in the table to organize instead of 1,2,3,4….
In your case, game.Players:GetPlayers()
returns an array of all of the players in the game. Since you can’t kick a table, you have to loop through the table, like this:
local players = game.Players:GetPlayers()
for i,v in ipairs(players) do
v:Kick(“idk”) --each v is a player, v is just the standard variable. Every v here is something in the table.
end
Thanks for the solution.,.,…,.,.,.,.,.,.,.,
Make sure to read Laser_Gun5540’s post to, as it provides a bit more information
Can one of you make it to where it groups all the players on a team so i can add a +1 win for each win they get
To get all players on a team, you would do game.Teams.TEAMNAME:GetPlayers(). I believe that’s what you are asking for right?
Yea thanks very much.,.,.,.,…,.,.,.,.,
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.