Global Leaderboard GUI displaying incorrect leaderstat?

So I am creating a global points leaderboard surface GUI in my game and I have the script set up from a youtube tutorial (I’m bad with datastores lol) and it works although it displaying a different set of data than what I want. I have “OOFs” and “Rebirths” in the datastore and I only want “OOFs” to be displayed for now.
Here is the script:

local WinsLeaderboard = DataStoreService:GetOrderedDataStore("Zer0CactusDataStore00fs5")

local suffixes = {'','K','M','B','T','qd','Qn','sx','Sp','O','N','de','Ud','DD','tdD','qdD','QnD','sxD','SpD','OcD','NvD','Vgn','UVg','DVg','TVg','qtV','QnV','SeV','SPG','OVG','NVG','TGN','UTG','DTG','tsTG','qtTG','QnTG','ssTG','SpTG','OcTG','NoAG','UnAG','DuAG','TeAG','QdAG','QnAG','SxAG','SpAG','OcAG','NvAG','CT'}
local function format(val)
	for i=1, #suffixes do
		if tonumber(val) < 10^(i*3) then
			return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]

local function updateLeaderboard()
        local success, errorMessage = pcall (function()
                local Data = WinsLeaderboard:GetSortedAsync(false, 12)
                local WinsPage = Data:GetCurrentPage()
                for Rank, data in ipairs(WinsPage) do
                       local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
                       local Name = userName
                       local Wins = data.value
                       local isOnLeaderboard = false
                       for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
                             if v.Player.Text == Name then
                                  isOnLeaderboard = true

                     if Wins and isOnLeaderboard == false then
                            local newLbFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
                            newLbFrame.Player.Text = Name
                            newLbFrame.Wins.Text = format(Wins)
                            newLbFrame.Rank.Text = "#"..Rank
                            newLbFrame.Position =, 0, newLbFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
                            newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder

      if not success then

while true do

        for _, player in pairs(game.Players:GetPlayers()) do
              WinsLeaderboard:SetAsync(player.UserId, player.leaderstats.OOFs.Value)

        for _, frame in pairs (game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do



Anyone know how I can choose which leaderstat displays on the leaderboard GUI if I have 2 leaderstats?

I may be incorrect but anything in the leaderstats folder get displayed, simply you would need to store the value in a custom different folder same as leader stats but with a different name.

Oh your using a custom leaderboard, this may not apply then.-edit

Yeah I just thouight that I could just change the part that says like data.key to a different thing like data.key2 hypothetically where its the 2nd stat of the 2 leaderstats if that makes any sense lol. I just don’t know how this works

Also I would probably be fine with the same leaderboard GUI showing both stats but I just don k is how to separate them when getting a stat from a data store if that makes sense

You can use two different datastores, one for OOFs and one for Rebirths. You don’t have to limit yourself to one datastore or choose strange names. You can get the data separately, then. Whichever value you save to a Value object in the player’s leaderstats folder would be the one displayed.

I just added the second stat in the latest update which actually reset everyone’s data so I don’t think I should mess with it again. I was hoping I could fix this within the leaderboard GUI script

If you insist on using a single datastore, then you must store the two values together. You can store them as a table like {numOOFs, numRebirths} and then you can save them and retrieve them together. Once you retrieve them, you’re free to dissect the table (table[1] or table[2]) and choose which one you want to put in Leaderstats for each player.