Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Leaderboard Name Tags?

Asked by 9 years ago

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:

game.Players.PlayerAdded:connect(function()
    local stats = Instance.new("IntValue", plr)
    stats.Name = "leaderstats"

    local money = Instance.new("IntValue", stats)
    money.Name = "Money"

end)

but I've yet to find a way to create surnames or tags to the player names. Any help with this?

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

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.

local groupID = 0000000 --Your group ID
local NotInGroup = 'Supporter' --What they'll be if they're not in the group

game.Players.PlayerAdded:connect(function()
    local stats = Instance.new("IntValue", plr)
    stats.Name = "leaderstats"

    local money = Instance.new("IntValue", stats)
    money.Name = "Money"

    local role = Instance.new('StringValue',stats)
    role.Name = 'Role'
    role.Value = plr:GetRoleInGroup(groupID) or NotInGroup
end)
Ad

Answer this question