How to put players in a server into a table

making a teleport system for a game, and i want to put players in a table so i can teleport a select few with in pairs loops
so how do i put players in a table all help is welcomed

1 Like

You can just loop through all players and then add them into the table

local Table = {}

for _, Player in pairs(game.Players:GetPlayers) do
   table.insert(Table, Player)
end

:GetPlayers() already returns a table, so you can simply just do:

local players = game.Players:GetPlayers(); -- this is the table of players

Ah sorry I forgot xD My bad my bad