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

How do i kick all players in the server?

Asked by 3 years ago
Edited 3 years ago

i've tried this but it didnt work code:

local players = game.Players:GetPlayers()
players:Kick("Shutdown") 

1 answer

Log in to vote
0
Answered by
Zero_Tsou 175
3 years ago
Edited 3 years ago

You need to loop through all the players in a for loop

local Players = game:GetService("Players") ---- game.Players
for _,Player in pairs (Players:GetPlayers()) do --- looping through all the players
    Player:Kick("Shutdown") --- kicking them one by one in a for loop
end
0
Thanks! IEntity_303I 80 — 3y
Ad

Answer this question