Q: How would I have multiple items on a leaderboard?
Hey, I’m Carlos and I’m having a little problem. I want to have a Minutes played leaderboard as well as their group rank leaderboard but it only shows their rank and not minutes. I would like to know if there is any way I can show both and not just one I will provide a picture below!
I’m assuming you have two scripts for each leaderboard. If so then its most likely that each script is creating a “leaderstats” folder/instance. This results in two leaderstats objects in the actual player, and so the game is just picking one of those and not the other.
What you need to do is have 1 leaderstats object and place all your values inside that one.
Is this what you mean? If so it does not work. I just copied on of the scripts and pasted it in to the other script.
game.Players.PlayerAdded:Connect(function(p)
local L = Instance.new(‘Folder’,p)
L.Name = ‘leaderstats’
local stats = Instance.new(‘StringValue’,L)
stats.Name = ‘Rank’
stats.Value = p:GetRoleInGroup(8128398) – Replace 3716701 with your Group ID
end)
local DataStoreService = game:GetService(“DataStoreService”)
local DataStore = DataStoreService:GetDataStore(“TimeStats”)
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new(“Folder”)
Leaderstats.Name = “leaderstats”
Leaderstats.Parent = Player
local Minutes = Instance.new(“IntValue”)
Minutes.Name = “Minutes”
Minutes.Value = 0
Minutes.Parent = Leaderstats
local Data = DataStore:GetAsync(Player.UserId)
if Data then
Minutes.Value = Data
end
coroutine.resume(coroutine.create(function()
while true do
wait(60)
Minutes.Value = Minutes.Value + 1
end
end))
No, do not just copy paste the scripts into the same one. Identify the parts that are the same and don’t repeat them. You are using two player Added functions, when you only need one.