Hello. I'm trying to figure out how give peoples names on the leader board tags.
E.G. Player name is "Player1". They are rank "General". On the leaderboard the name would appear as "General Player1".
I know how to add stats like this:
1 | game.Players.PlayerAdded:connect( function () |
2 | local stats = Instance.new( "IntValue" , plr) |
3 | stats.Name = "leaderstats" |
4 |
5 | local money = Instance.new( "IntValue" , stats) |
6 | money.Name = "Money" |
7 |
8 | end ) |
but I've yet to find a way to create surnames or tags to the player names. Any help with this?
There are two ways to do this -
1) Make a leaderstat for their role
2) Make a custom leaderboard
2 is more difficult and more in depth but it will most likely give you a better end product as well as easier configuration.. but it's a bit broat to answer how you make a custom leaderboard so i'll explain 1.
Make a leaderstat named 'Role' and use the GetRoleInGroup method for the value of the stat.
01 | local groupID = 0000000 --Your group ID |
02 | local NotInGroup = 'Supporter' --What they'll be if they're not in the group |
03 |
04 | game.Players.PlayerAdded:connect( function () |
05 | local stats = Instance.new( "IntValue" , plr) |
06 | stats.Name = "leaderstats" |
07 |
08 | local money = Instance.new( "IntValue" , stats) |
09 | money.Name = "Money" |
10 |
11 | local role = Instance.new( 'StringValue' ,stats) |
12 | role.Name = 'Role' |
13 | role.Value = plr:GetRoleInGroup(groupID) or NotInGroup |
14 | end ) |