Group ranking with Roblox OpenCloud!

Hey YungAK_365,

So the good news is that my API key is valid! However, I get an error in the provided ModuleScript saying that “Argument 1 missing or nil” on line 95, which seems to be retrieving group data…? I’m not so sure if this is because of the script itself or your updates on the OpenCloud API.
image

local function getMembershipId(userId: number): (boolean, string)
	local membershipFilter = `user == 'users/{userId}'`
	local searchSuccess, responseBody = requestRobloxAPI(
		`https://apis.roblox.com/cloud/v2/groups/{GROUP_ID}/memberships?maxPageSize=10&filter={membershipFilter}`,
		"GET"
	)
	responseBody = HttpService:JSONDecode(responseBody.Body)
	if searchSuccess and responseBody.groupMemberships and 
		responseBody.groupMemberships[1] and 
		responseBody.groupMemberships[1].path 
	then
		--Path format: groups/{group_id}/memberships/{group_membership_id}
		local unfilteredText = responseBody.groupMemberships[1].path
		unfilteredText = string.split(unfilteredText, "/")
		return true, unfilteredText[4]
	else
		return false, responseBody
	end
end

DeveloperSimple

Hmm not able to reproduce on my end. I would put a debug print statement right before line 95 printing the responseBody variable to see what it looks like (since it seems the body is missing from your screenshot). Let me know what your output is from that

I got this:
22:19:36.280 Header x-api-key has unallowed character - Server - GroupCloud:95

Hey brother,

I tried the Base64 encoded one. It didn’t work at the first time and then I used the original API key that we did at first step and I paste that in either on Roblox Studio and on roblox web. It actually worked.

Thanks bro.

1 Like

That error is returned when the API key you have pasted has unexpected characters. Are you sending requests in Studio, Team Test, or live game server?

Also could you double check that you have pasted the raw API key (not base64 encoded) in both Studio for local secrets (https://create.roblox.com/docs/cloud-services/secrets#local-secrets) and in Creator Hub for live game server secrets (https://create.roblox.com/dashboard/creations/experiences/{ExperienceID}/secrets)? Thanks!

lol what actually is the point of this update if it doesnt even work. I’ve tried everything bro roblox releases something and it never works. Literally if it’s not gonna work just remove this update. All I wanted to do was update a users group rank when they reached level 5 you can literally just put this directly in roblox studio. ROBLOX is ur website why are you making some API?

Hey there, what is not working for you? Can you share more information? Feel free to post a bug report if we missed anything, but we confirmed this feature is working fine if implemented according to the documentation.

I’m trying to rank a member when they step on a part in my game that levels you up +1 level so I’m trying to test stuff at the moment. I appreciate for reaching out. I want to make it so if you reach level 5 in my game you get autoranked to a specific role in my group it only works in roblox studio, bet never the actual game (aka live servers) also, since you responded.

Please dude for the love of god add compatibility lighting back. I’ve been begging you guys for almost a year now. It ruined my dancefloor game which relied on the lighting heavily it gets too bright and hurts my eyes. Or at least add brightness clamping as a option for the lighting settings. I have tried surfacelighting, problem with surfacelighting you can’t make it go all points of view like point lights do and leaves a huge bright line. I’ve tried to reduce the amount of point lights and it has shading issues for example if you jump it hurts your eyes because the light doesnt stay the same, but it like bounces. Like please reconsider my suggestion. Please

Can you submit a bug report with more details on your issue with Open Cloud?

I don’t work on rendering, so I don’t know about the second portion of your comment, sorry.

2 Likes

Is it still required to encrypt the API key to Base64? I’m reading the documentation and it doesn’t seem to mention it (anymore?)

Probably not. It was mentioned in another post here.

1 Like

The fix is relatively simple. Just add this piece of code after the requestRobloxAPI() function;

		rolesBody = HttpService:JSONDecode(rolesBody.Body)

Explanation: Whenever requestRobloxAPI() is called, it returns 2 values, first one is the success boolean and the second one is the the rolesBody in JSON format. ‘rolesBody’ variable is then assigned a new value and that value is the second value returned out of the requestRobloxAPI() function. The new and updated ‘rolesBody’ value does NOT have a ‘groupRoles’ index directly because it is found in the array of the ‘Body’ index and as a result, you have to first index the ‘Body’ before accessing any values inside of that array.

Not to mention, but you also cannot loop through JSON arrays directly in Luau, hence the reason we’ve JSON decoded it.

At last, the final segment of that code should look something like this;

while rolesBody.nextPageToken ~= "" do
			rolesSuccess, rolesBody = requestRobloxAPI(
				`https://apis.roblox.com/cloud/v2/groups/{GROUP_ID}/roles?maxPageSize=20&pageToken={rolesBody.nextPageToken}`,
				"GET"
			)
            rolesBody = HttpService:JSONDecode(rolesBody.Body)
			if rolesSuccess and rolesBody and rolesBody.groupRoles == nil then
				rolesBody = HttpService:JSONDecode(rolesBody.Body)	
			end
			
			if rolesSuccess and rolesBody.groupRoles then
				for _,v in pairs(rolesBody.groupRoles) do
					table.insert(UNCLEANED_ROLES, v)
				end
			else
				return false, "Could not get groupRoles nextPageToken reponse body!"
			end
		end
1 Like

Is this just an explanation of my fix..?