01_0101100
(SuperUser)
December 27, 2021, 9:16pm
#1
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.
1_upz
(upz)
December 27, 2021, 9:25pm
#2
local Players = {}
for i,v in pairs(game.Players:GetChildren()) do
table.insert(Players,v,#Players+1)
end
print(Players)
01_0101100
(SuperUser)
December 27, 2021, 9:26pm
#3
Yeah i meant getting the players in the whole “experience” or if you prefer all active game server.
1_upz
(upz)
December 27, 2021, 9:27pm
#4
I tried this recently, you have to use the api
These might be useful
https://developer.roblox.com/en-us/api-reference/class/HttpService
notMundaze
(cookdaze)
December 27, 2021, 9:28pm
#5
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
legs_v
(legs)
December 27, 2021, 9:30pm
#6
You do know you can just do
table.insert(Players, v)
1_upz
(upz)
December 27, 2021, 9:38pm
#7
Doesn’t particularly matter since you get the same result either way
legs_v
(legs)
December 27, 2021, 9:43pm
#8
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)
01_0101100
(SuperUser)
December 27, 2021, 10:25pm
#9
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
MP3Face
(MP3Face)
December 27, 2021, 10:34pm
#10
Instead of using http posts/requests you could use MessagingService to share tables of players between servers.