How to get a list of all player in an experience

Hello, i’m working on a custom connection system and i would need to get a list of all player in the experience so i could make a list.

I strangly did not find anything helpful on the dev forum. If there is something useful you found please send it.

Thanks.

local Players = {}

for i,v in pairs(game.Players:GetChildren()) do 
	table.insert(Players,v,#Players+1)
end

print(Players)

Yeah i meant getting the players in the whole “experience” or if you prefer all active game server.

I tried this recently, you have to use the api

These might be useful
https://developer.roblox.com/en-us/api-reference/class/HttpService

local players = game.Players:GetChildren()
this becomes a table with all the names

if you do for i = 1,#players do
print(i…" is a player name")
end

You do know you can just do

table.insert(Players, v)

Doesn’t particularly matter since you get the same result either way

The # to determine the length of an array/table isn’t always consistent with measuring the length which can cause that method to be less accurate than a normal table.insert(t, v)

If i right i should use this [/v1/games/{placeId}/servers/{serverType}]?
Edit : I think i figured out on how to use it.

1 Like

Instead of using http posts/requests you could use MessagingService to share tables of players between servers.