How to check an offline player's group rank

I want to make a script that would use an offline player’s username to get their user id, then to get the group rank of an offline user.

There isn’t much online about getting the group rank of an offline user and I’m not that great with API, so I came to ask here. Any help would be appreciated.

2 Likes

https://groups.roblox.com/docs#!/Groups/get_v2_users_userId_groups_roles

You would just need to send a GET request to https://groups.roblox.com/v2/users/{userId}/groups/roles then JSONDecode the response then iterate the decoded data with a for loop then check if the group id in the “group” field matches the group you want and then get the group role from the “role” field

You did answer my question, but how would I make the for loop? Would it be for i, v in pairs() loop, or would it be a for i = 1, #DECODED_DATA do loop?

for i, v in ipairs(decodedData) do
    if v.group.id == 12345 then
        return v.role.id
    end
end

You can also do it with for i = 1, #DECODED_DATA do, but the former looks cleaner in my opinion

for i = 1, #decodedData do
    local v = decodedData[i]
    if v.group.id == 12345 then
        return v.role.id
    end
end
3 Likes

I’m having another problem. Whenever I try to use Https:GetAsync() with the url you provided (“{userid}” is replaced with an actual userId), I just get an error saying “trust check failed”.

You need to use some kind of proxy because you can’t make requests to roblox.com from in game. You can make your own or you can use rprxy.xyz

https://groups.rprxy.xyz/v2/users/{userId}/groups/roles

Works! Thanks for the help. :grinning_face_with_smiling_eyes: