Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to I make a second column in my leaderboard for group rank?

I don't have much script for you to look at, since there's only one piece at the moment. However, I have a 'Time Alive' counter, and I need there to be a second column on the leaderboard. Previous tutorials have only replaced the counter with the group rank. The group ID is 6228794 if needed. Here is my script for the Time Alive counter:

game.Players.PlayerAdded:connect(function(player)
	local Stats = Instance.new("Model", player)
	Stats.Name = "leaderstats"
	local Timer = Instance.new("IntValue", Stats)
	Timer.Name = "Time Alive"
	Timer.Value = 0
	while true do
		wait(1)
		Timer.Value = Timer.Value + 1
		if player.Character.Humanoid.Health == 0 then
			Timer.Value = 0
		end
	end 
end)

Can anyone help?

1 answer

You can do this:

game.Players.PlayerAdded:connect(function(player)
    local Stats = Instance.new("Model", player)
    Stats.Name = "leaderstats"
    local Timer = Instance.new("IntValue", Stats)
    Timer.Name = "Time Alive"
    Timer.Value = 0
    local Role = Instance.new("StringValue", Stats)
    Role.Name = "Role" -- or "Rank"
    Role.Value = player:GetRoleInGroup(6228794) -- or player:GetRankInGroup(6228794)
    while wait(1) do
        Timer.Value = Timer.Value + 1
    end
    player.CharacterAdded:Connect(function(Char)
        Char:WaitForChild("Humanoid").Died:Connect(function()
            Timer.Value = 0
        end
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.