Need Help: Retrieving Player Rank Outside the Game

Hello there!

I would like to achieve the ability to retrieve a player’s rank when they are NOT in the game. I am aware that :GetRankInGroup only works when the player is in-game.

I’ve tried researching information in various places, including checking documentation specifically related to groups. However, I’m struggling to figure it out. I’ve looked at the GroupService documentation, but I couldn’t find a solution.

If anyone can help me with this, I would greatly appreciate it. Thank you for taking the time to read and/or assist!

1 Like

here

1 Like

I was reading upon it and notice if I edit it a bit to my liking to get the result I need.

For anyone that’s reading upon this topic feel free to copy the seprate function.

And ofcourse thank you Placoom. Your expertise has been invaluable! And now I can continue!

The script:

-- Function to get a player's rank in a specific group (must have targetplayerid)
local function getPlayerRankInGroup(TargetPlayerId, GroupId)
	local success, playerGroups = pcall(function()
		return GroupService:GetGroupsAsync(TargetPlayerId)
	end)

	if success then
		for _, groupInfo in pairs(playerGroups) do
			if groupInfo["Id"] == GroupId then
				return groupInfo["Rank"]
			end
		end
	end

	return nil  -- Return nil if the player is not in the specified group
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.