I found this but rprxy is shutdown
Is there a new way to do it?
I found this but rprxy is shutdown
Is there a new way to do it?
i believe this will help you
No, I need to get ALL members that have the role.
honestly I didn’t even know this was even possible at some point in time. but just wondering why do you need to get all players of a certain role from a group?
Just use player:getroleingroup() – needs groupid and then do a 8f statement so like
Local rank = player:GetRoleInGroup(7474) -- group id
If rank == "Admin" then
Print("cool"..rank)
thats what i suggested earlier but OP said he needs a way to find ALL members with that role.
But is the most easest wait and do it with loop and filter out people without that rank
I think OP is trying to get all players that have a certain role in the group regardless of whether or not they are in the game. there’s no way (that i know of) to get every player inside a group and loop through them to check each and every one of their ranks.
Ok yeah idk that possible unless you can use a sorted datastore like gobal leaderboards
I tried that but it didn’t work for me. I might be doing something wrong with the url.
Replace the roblox
part with roproxy
. Example:
https://groups.roblox.com/v2/groups?groupIds=7
to:
https://groups.roproxy.com/v2/groups?groupIds=7
How can I get the roles after?
If your group role has more than 100 people (the limit you can fetch at one time, you won’t be able to get ALL of them)
Here is a script I wrote that will automatically do this for you.
You just need to call getUsersByRank(groupId,rankId)
and it’ll return success,isPaginated,data
if it’s successful, and it’s not paginated, ‘data’ will have all of the users in that role. If it’s successful and paginated, you’ll have to use :getCurrentPage() and :getNext() to get 100 at a time users, both examples will be below.
local httpService = game:GetService("HttpService")
local limit = 100
local base = "https://groups.roproxy.com"
local rolesetUrl = `{base}/v1/groups/%s/roles`
local getUsersUrl = `{base}/v1/groups/%s/roles/%s/users?limit={limit}&sortOrder=Asc`
local request = function(url)
local success,response = pcall(function()
return httpService:GetAsync(url)
end)
if not success then
warn(response)
return false
else
return true,httpService:JSONDecode(response)
end
end
local getRolesets = function(groupId)
local success,response = request(rolesetUrl:format(groupId))
if success then
local toReturn = {}
for _,role in pairs(response.roles) do
if(role.rank ~= 0) then
toReturn[role.rank] = {
memberCount = role.memberCount,
rolesetId = role.id,
name = role.name
}
end
end
return toReturn
else
return {}
end
end
local getRoleByRank = function(groupId,rank)
return getRolesets(groupId)[rank]
end
local paginate = function(response,url)
local pages = {}
local keys = {}
pages[1] = response.data
pages.pageNumber = 1
function pages:getCurrent()
return pages[pages.pageNumber]
end
function pages:getNext()
if(pages[pages.pageNumber + 1] == nil) then
local nextPageCursor = response.nextPageCursor
if nextPageCursor then
local success,resp = request(`{url}&cursor={nextPageCursor}`)
if success then
response = resp
pages.pageNumber += 1
pages[pages.pageNumber] = resp.data
return resp.data
end
else
return false
end
else
pages.pageNumber += 1
return pages[pages.pageNumber]
end
end
function pages:getPrevious()
pages.pageNumber -= 1
return pages[pages.pageNumber]
end
return pages
end
local getUsersByRank = function(groupId,rank)
local role = getRoleByRank(groupId,rank)
if role then
local url = getUsersUrl:format(groupId,role.rolesetId)
local success,response = request(url)
if role.memberCount <= limit then
return true,false,response.data
else
return true,true,paginate(response,url)
end
else
return false,false,{}
end
end
-- Example: Roblox group
local success,isPaginated,data = getUsersByRank(7,1)
if success then
print(success,isPaginated,data)
local users = {}
for _,user in pairs(data:getCurrent()) do
table.insert(users,user)
end
for i = 1,10 do
for _,user in pairs(data:getNext()) do
table.insert(users,user)
end
end
print(users)
end
-- Example: (small group)
local success,isPaginated,data = getUsersByRank(9231886,1)
if success then
print(data)
end