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?