How to Get Users in a Role in a Group Using HttpService

I’m trying to get users in a selected role with HttpService, but it errors with “HTTP 400 (Bad Request)” so how would I fix this or do this differently?

local HttpService = game:GetService("HttpService")
local response = HttpService:JSONDecode(

Also tried searching the Developer Forum but none of the topics helped.


You need to use{groupId}/roles to get their ids. Then use the endpoint you used to get the users.


I don’t think you even need to use HttpService. You can check if a player is in a group or is a certain rank without any services. Example:

local rank = 0 -- The rank the player will need to get through

local groupID = 0 -- The group ID the player must be in

local character = game.Players.LocalPlayer

if (character:IsInGroup(groupID) and character:GetRankInGroup(groupID) == rank) then

print("The player is the correct rank.")


Just if you’re wondering, yes, I did test this. It works fine.

Could you show me an example I’d do that? I thought the role ids were just the group rank.

@SpeakerDev I’m not checking if a player is in a group or their roles I’m looking at users inside a group at a certain rank.

You could chain them like so:

local HttpService = game:GetService("HttpService")

function GetUsersInRank(groupId, rankNumber)
	local rankIds = HttpService:JSONDecode(
	if rankIds.roles == nil then 
		warn("Something went wrong")
	for i, v in ipairs(rankIds.roles) do
		if v.rank == rankNumber then
			return HttpService:JSONDecode(
	return nil

print(GetUsersInRank(4585564, 255))

Basically, ranks have an id behind them like an asset id. This id is not the same as the rank number. This id is a unique identifier across the platform and will only ever identify that one role.


Also is it possible to get the result by only using GetAsync once since you can only send 500 HTTP requests a minute and you might be doing other things with HttpService?

You can cache the rolesets of each group id and request it only when needed.

1 Like