Help with leaderboards

Hello Developers!

Do you guys know how to make a minutes played and clothes purchased leaderboard like here:

1 Like

Use a DataStore to save the value between sessions and then add onto the value whenever someone buys a shirt or if it’s been a minute since the last time their minute score was increased

I dont know how to script thats the problem xdd

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You have to learn to code yourself. Do you understand any Lua?

I will assume that you already know how to make the leaderstatas (That thing in the format of a leaderboard in the side.)

So basically you set a variable that you give the value only in the PlayerAdded event, you will need a data store.

local DSS = game:GetService("DataStoreService")
local leaderstatsData = DSS:GetDataStore("LeaderstatsData")
local timePlayed
game.Players.PlayerAdded:Connect(function(player)
      -- Do the thing to get the data
      local leaderData = leaderstatsData:GetAsync(player.UserId)
      if leaderData["Minutes"] then
            leaderstats.Minutes.Value = leaderData["Minutes"]
            timePlayed = leaderstats.Minutes.Value
      else
            timePlayed = 0
      end
      if leaderData["Purchases"] then
              leaderstats.Purchases.Value = leaderData["Purchases"]
      end
      while wait(60) do
            timePlayed = timePlayed + 1
      end
end)

After all you need to do is save the data. Its not so hard (I dont know how to make the purchases right now but going at the developer thing in roblox or object browser would probably give the answer)

2 Likes