How does roblox add special icons to the leaderboard/how to properly identify a player group?

I’m trying to figure out how roblox loads certain icons for certain groups of players into the default leaderboard.
I made my leaderboard, here is the script to determine the group of players and the icons assigned to them:

My Script
	if plr.MembershipType == Enum.MembershipType.Premium then
		Clone.IconFrame.Icon.Image = Icons["Premium"]
	end
	if plr:IsInGroup(1200769) then
		Clone.IconFrame.Icon.Image = Icons["Admin"]
	end
	if plr:IsInGroup(4199740) then
		Clone.IconFrame.Icon.Image = Icons["Star"]
	end
	if plr.UserId == 3320407672 then
		Clone.IconFrame.Icon.Image = Icons["Developer"]
	end

Everything seems fine, but I wanted to make sure I had the correct method of certain player groups.
And finding this file:
%localappdata%\Roblox\Versions\VERSION\ExtraContent\scripts\CoreScripts\Modules\PlayerList\Reducers\PlayerIconInfo.lua

It turns out that the game’s developer can be defined this way:

if Player.UserId == game.CreatorId then ...

After that I wondered if I correctly determine the administrator and the star.
I tried to find a script, how roblox itself determines what kind of player, but my knowledge is not enough to understand where roblox takes this information.
In this file: %localappdata%\Roblox\Versions\VERSION\ExtraContent\scripts\CoreScripts\Modules\PlayerList\Components\PresentationCommon\PlayerIcon.lua

There are certain groups, but the script refers to some data that I haven’t understood where it comes from.
In this file: %localappdata%\Roblox\Versions\VERSION\ExtraContent\scripts\CoreScripts\Modules\PlayerList\CreateLayoutValues.lua

Spelled out what icons to apply for certain groups of players, but there was still no answer: how roblox defines a group of players.

To summarize: My code will work correctly, but I’m an advocate of writing code completely correctly, not crutch code.
As it was in this case:

Example
-- like I did (not the right way).
if plr.UserId == 3320407672 then
	Clone.IconFrame.Icon.Image = Icons["Developer"]
end
-- Correct method
if plr.UserId == game.CreatorId then
	Clone.IconFrame.Icon.Image = Icons["Developer"]
end
--I didn't know there was such a way

So the question is, is this certain, right?:

if plr:IsInGroup(1200769) then ... -- Roblox Administrator
if plr:IsInGroup(4199740) then ... -- Roblox Video Star

Inside roblox the same script to determine the player group, or is there a better method there?

1 Like

In Roblox, there is no direct and foolproof way to determine if a player is an Administrator or a Video Star. The Player object and Roblox API do not provide any specific properties or methods to identify a player’s status as a YouTuber or Admin.

So the only way is to use the IsInGroup method as it is the correct and intended way to do so. The method IsInGroup(groupId) is specifically designed to check whether a player belongs to a particular group based on their Player object and there is no better way of doing it.

So yes, it is certain and there is no better method.

1 Like

Just an addendum:
Using Notepad++ and “Find in Files” by word, was able to find a file like this:
%localappdata%\Roblox\Versions\VERSION\ExtraContent\scripts\CoreScripts\ServerCoreScripts\ServerSocialScript.lua.

Parts of the code from this file:

local SPECIAL_GROUPS = {
	Admin = {GroupId = 1200769},
	Intern = {GroupId = 2868472, GroupRank = 100},
	Star = {GroupId = 4199740},
}
local function getPlayerGroupDetails(player)
	local newGroupDetails = {}
	for groupKey, groupInfo in pairs(SPECIAL_GROUPS) do
		if groupInfo.GroupRank ~= nil then
			local isInGroupSuccess, isInGroupValue = pcall(function() return player:GetRankInGroup(groupInfo.GroupId) >= groupInfo.GroupRank end)
			newGroupDetails[groupKey] = isInGroupSuccess and isInGroupValue
		else
			local isInGroupSuccess, isInGroupValue = pcall(function() return player:IsInGroup(groupInfo.GroupId) end)
			newGroupDetails[groupKey] = isInGroupSuccess and isInGroupValue
		end
	end
end

And it confirms that this is the best method.
Also, I realized that I don’t have an “Intern” icon, but now I will.

1 Like

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