So I want to get all the players in the group for something I want to do but I can’t seem to find how to do this anywhere. Does anyone know how to do this?
Can’t do it with Roblox API but you can check if a player in the game is in the group using some player API functions like player:IsInGroup()
and you can use GroupsService for players not in the game.
A very roundabout way of doing this would be having either a requirement for people to join the group (For example they have to join a place for Verification, and this place logs that user joining in a datastore) or you could have a Bot set up for that group which gets every player. < using noblox https://noblox.js.org/#introduction. Other than that I am unaware of any other methods which would allow you to get every single player within a group.
But I want to get all the players in a group even if they are not in the game
That just wouldn’t be possible given the Roblox API.
found this https://groups.roblox.com/v1/groups/6467229/roles/41631558/users?cursor=&limit=50&sortOrder=Desc, first number is probably group id and second is role id?
if you are curious on how i found it, it was by using the Network tab in developer tools:
HTTP Request: https://groups.roblox.com/v1/groups/GroupId/users?sortOrder=Asc&limit=100
However you cannot do this from Roblox, you must use a proxy/webserver due to limitations on HttpService.
You’d need to keep looping until nextPageCursor
is null to have all the members.
The group has more than 100 members and it doesn’t display the roles I need, I need it to display the higher roles rather than the members
100 is the limit it returns per page, not only 100 overall.
You’d need to use if checks to determine their rank.
Loop and break the loop once nextPageCursor is null. Add each username/id entry into an array then send it back to the game. The returned object will be a list of each name/id depending which you choose.
What it Returns (hidden so it doesn't flood)
{
"previousPageCursor":null,
"nextPageCursor":null,
"data":[
{
"user":{
"buildersClubMembershipType":"None",
"userId":1526798957,
"username":"Rileythegamercool",
"displayName":"Rileythegamercool"
},
"role":{
"id":33811880,
"name":"Member",
"rank":1,
"memberCount":3
}
},
{
"user":{
"buildersClubMembershipType":"None",
"userId":464804960,
"username":"Noble_theSwift",
"displayName":"Noble_theSwift"
},
"role":{
"id":33811880,
"name":"Member",
"rank":1,
"memberCount":3
}
},
{
"user":{
"buildersClubMembershipType":"None",
"userId":1224351089,
"username":"vishnucr77",
"displayName":"vishnucr77"
},
"role":{
"id":33811880,
"name":"Member",
"rank":1,
"memberCount":3
}
},
{
"user":{
"buildersClubMembershipType":"None",
"userId":113430644,
"username":"phoenixcards1234",
"displayName":"phoenixcards1234"
},
"role":{
"id":33811935,
"name":"Trainee",
"rank":2,
"memberCount":1
}
},
{
"user":{
"buildersClubMembershipType":"None",
"userId":201989656,
"username":"iiRealistic_Dev",
"displayName":"iiRealistic_Dev"
},
"role":{
"id":33811879,
"name":"Assistant Director",
"rank":6,
"memberCount":1
}
},
{
"user":{
"buildersClubMembershipType":"None",
"userId":656842840,
"username":"BakDoor",
"displayName":"BakDoor"
},
"role":{
"id":33811878,
"name":"Director",
"rank":255,
"memberCount":1
}
}
]
}
https://groups.roblox.com/v1/groups/{GroupId}/users?sortOrder=Asc&limit=10&cursor={ReturnedNextPageCursor}
So I used this script
local HttpService = game:GetService("HttpService")
local URL = "https://groups.roblox.com/v1/groups/6094444/users?sortOrder=Asc&limit=100"
local data
local response
local function printData()
pcall(function ()
response = HttpService:GetAsync(URL)
data = HttpService:JSONDecode(response)
end)
return true
end
if printData() then
print(data)
print(response)
else
print("Something went wrong")
end
But both of the values keep returning false
You will need a proxy server to make the requests to Roblox. HttpService will not allow you to make any requests to a Roblox-owned domain.