Hi, so I have KOs, WOs, and group rank but how can I also display the name of a Roblox group on the leader board (preferably abbreviated).
This is what I’ve done so far.
--Kills/Deaths
local Players = game.Players
local Template = Instance.new 'BoolValue'
Template.Name = 'leaderstats'
Instance.new('IntValue', Template).Name = "Kills"
Instance.new('IntValue', Template).Name = "Deaths"
Players.PlayerAdded:connect(function(Player)
wait(1)
local Stats = Template:Clone()
Stats.Parent = Player
local Deaths = Stats.Deaths
Player.CharacterAdded:connect(function(Character)
Deaths.Value = Deaths.Value + 1
local Humanoid = Character:FindFirstChild "Humanoid"
if Humanoid then
Humanoid.Died:connect(function()
for i, Child in pairs(Humanoid:GetChildren()) do
if Child:IsA('ObjectValue') and Child.Value and Child.Value:IsA('Player') then
local Killer = Child.Value
if Killer:FindFirstChild 'leaderstats' and Killer.leaderstats:FindFirstChild "Kills" then
local Kills = Killer.leaderstats.Kills
Kills.Value = Kills.Value + 1
end
return
end
end
end)
end
end)
end)
--Group Rank
local GroupID = 3534363
local CharHide = 0
game:GetService('Players').PlayerAdded:Connect(function(p)
local ls = Instance.new('IntValue', p)
ls.Name = 'leaderstats'
local rank = Instance.new('StringValue', ls)
rank.Name = 'Rank'
rank.Value = 'Guest'
if p:IsInGroup(GroupID) then
local xrole = p:GetRoleInGroup(GroupID)
if string.len(xrole) <= CharHide then
warn('[GroupLeaderboard] Attempted to hide more characters than role has; using default name')
rank.Value = xrole
else
local role = string.sub(xrole, CharHide+1)
rank.Value = role
end
end
end)