Leaderboards Help Need

Hey, me and my friend @katiesdcmod
are having trouble with the leaderboard, the rebirth and the gems leaderboard to be exact
the leaderboards worked fine, but they stoped updating i dont know for what reason, and when we run the code it doesnt show any error


if someone could help us figure out what’s the problem we would appreciate it

Without the necessary code, we cannot help you.

yeah, the code its too big it doesnt let me place it here

1 Like
local LeaderboardService = {}

--// Services 
local players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local ds = game:GetService("DataStoreService")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--// Variables
local DataFolder = ServerStorage:WaitForChild("Data")
local leaderboardsFol = game.Workspace:WaitForChild("Leaderboards")
local Stands = leaderboardsFol:WaitForChild("Stands")
local InvisibleBoxes = Stands:WaitForChild("InvisibleBoxes")
local NPCS = Stands:WaitForChild("NPCS")
local RepModules = ReplicatedStorage:WaitForChild("Modules")
local proto = ServerStorage.ItemStorage.Extra.LeaderboardFrame
local overAllVersion = require(DataFolder.UserDataKey).LeaderboardKeyVersion
local waitTimePerLeaderboard = (#leaderboardsFol:GetChildren()) - 1
local UpdateGoalsCounter, UpdateServerMessage = 0, 0

--// Modules
local DataController = require(DataFolder.DataController)
local TimePlayedModule = require(script.Parent.TimePlayed)
local Abbreviate = require(RepModules.Abbreviate)
local timeString = require(RepModules.TimeString)
local notOnLeaderboards = require(script.BannedLeaderboardUsers)
local CommunityGoalsModule = require(script.Parent.CommunityGoals)
local ChestServerController = require(script.Parent.Parent.Chests.ChestServerController)
local ServerChatMessagesModule = require(script.Parent.Parent.Egg.EggServerHandler.ServerChatMessages)
local PetHandler = require(script.Parent.Parent.Pet.PetHandler)```
local LeaderboardService = {}

--// Services 
local players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local ds = game:GetService("DataStoreService")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--// Variables
local DataFolder = ServerStorage:WaitForChild("Data")
local leaderboardsFol = game.Workspace:WaitForChild("Leaderboards")
local Stands = leaderboardsFol:WaitForChild("Stands")
local InvisibleBoxes = Stands:WaitForChild("InvisibleBoxes")
local NPCS = Stands:WaitForChild("NPCS")
local RepModules = ReplicatedStorage:WaitForChild("Modules")
local proto = ServerStorage.ItemStorage.Extra.LeaderboardFrame
local overAllVersion = require(DataFolder.UserDataKey).LeaderboardKeyVersion
local waitTimePerLeaderboard = (#leaderboardsFol:GetChildren()) - 1
local UpdateGoalsCounter, UpdateServerMessage = 0, 0

--// Modules
local DataController = require(DataFolder.DataController)
local TimePlayedModule = require(script.Parent.TimePlayed)
local Abbreviate = require(RepModules.Abbreviate)
local timeString = require(RepModules.TimeString)
local notOnLeaderboards = require(script.BannedLeaderboardUsers)
local CommunityGoalsModule = require(script.Parent.CommunityGoals)
local ChestServerController = require(script.Parent.Parent.Chests.ChestServerController)
local ServerChatMessagesModule = require(script.Parent.Parent.Egg.EggServerHandler.ServerChatMessages)
local PetHandler = require(script.Parent.Parent.Pet.PetHandler)

--// Leaderboards
local leaderboards = {}
for _, v in pairs(leaderboardsFol:GetChildren()) do
    if v:IsA("Model") then
        leaderboards[v.Name] = v
    end
end
--// Update Variables
local CAN_RUN_MODULE = false
local UPDATE_TIME = 180
local divider = 10000
local rebirthDivider = 1
local minimalVal = 1

--// DataStores
local Clicks_DataStore = ds:GetOrderedDataStore("Clicks_Leaderboard_"..overAllVersion)
local Gems_DataStore = ds:GetOrderedDataStore("Gems_Leaderboard_"..overAllVersion)
local Rebirths_DataStore = ds:GetOrderedDataStore("Rebirths_Leaderboard_"..overAllVersion)
local Super_Rebirths_DataStore = ds:GetOrderedDataStore("S_Rebirths_Leaderboard_"..overAllVersion)
local TimePlayed_DataStore = ds:GetOrderedDataStore("TimePlayed_Leaderboard_"..overAllVersion)
local TopEggHatch_DataStore = ds:GetOrderedDataStore("TopEggHatch_Leaderboard_"..overAllVersion)
local TopStreaks_DataStore = ds:GetOrderedDataStore("TopStreaks_Leaderboard_"..overAllVersion)

--// Local Functions
local getDataStore = function(name)
    if name == "Clicks" then
        return Clicks_DataStore
    elseif name == "Gems" then
        return Gems_DataStore
    elseif name == "Rebirths" then
        return Rebirths_DataStore
    end
end
function LeaderboardService:GetStat(plr, statName)
    return DataController:GetStatFromPlayer(plr, tostring(statName))
end

local getValForDataSet = function(plr, name)
    if name == "Clicks" then
        local clicks = LeaderboardService:GetStat(plr, "TotalClicks")

        return tonumber(clicks), true

    elseif name == "Gems" then
        local gems = LeaderboardService:GetStat(plr, "TotalGems")

        return tonumber(gems), true    

    elseif name == "Rebirths" then
        local rebirths = LeaderboardService:GetStat(plr, "TotalRebirths")

        return tonumber(rebirths), true    

    elseif name == "TopSuperRebirths" then
        local superRebirths = LeaderboardService:GetStat(plr, "TotalSuperRebirths")
        return tonumber(superRebirths), false    
    elseif name == "TopTime" then
        local timePlayed = TimePlayedModule:UpdateTimePlayed(plr)
        return timePlayed, false
    elseif name == "TopEggHatch" then
        local eggsHatched = LeaderboardService:GetStat(plr, "TotalEggsOpened")
        return eggsHatched, false
    elseif name == "TopStreaks" then
        local currentStreak, last2DayClaim = ChestServerController:GetCurrentStreak(plr, "Daily Chest")
        if (os.time() - last2DayClaim) >= (48 * 3600) then
            return 0, false
        else
            return currentStreak, false
        end
    end
end
local Round_Function = function(n)
    return (n + 0.5) - (n + 0.5) % 1
end 
local errorMsg = function(msg, name, plrName)
    warn("Error For "..tostring(plrName).."'s "..tostring(name).." Leaderboard! Error:", tostring(msg))
end
local cloneUI = function(leaderboardName, rank, name, val, parent)
    if leaderboardName and rank and name and val and parent then
        if tonumber(val) >= minimalVal then 
            local clone = proto:Clone()

            clone.PlayerName.Text = tostring(name)
            clone.Rank.Text = "#"..tostring(rank)
            clone.Name = tostring(name)
            clone.LayoutOrder = tonumber(rank)

            if leaderboardName == "TopTime" then
                clone.Amount.Text = timeString(tonumber(val))
            elseif leaderboardName == "Clicks" or leaderboardName == "Gems" then
                local newVal = tonumber(val) --* divider
                clone.Amount.Text = Abbreviate:ReturnShort(tonumber(newVal))
            elseif leaderboardName == "Rebirths" then
                local newVal = tonumber(val) * rebirthDivider
                clone.Amount.Text = Abbreviate:ReturnShort(tonumber(newVal))
            else
                clone.Amount.Text = Abbreviate:ReturnShort(tonumber(val))
            end

            clone.BackgroundColor3 = Color3.fromRGB(189, 136, 0)
            clone.Visible = true
            clone.Parent = parent
        end
    end
end
function LeaderboardService:BanHacker(plrName)
    spawn(function()
        local plrID = nil
        local Success, Err = pcall(function()
            plrID = players:GetUserIdFromNameAsync(tostring(plrName))
        end)
        if plrID ~= nil then
            for _, v in pairs(leaderboardsFol:GetChildren()) do
                if v:IsA("Model") then
                    local leaderboardName = v.Name
                    local set, fail = pcall(function()
                        local data = getDataStore(leaderboardName)
                        if data ~= nil then
                            data:RemoveAsync(plrID)
                        else
                            errorMsg("DataStore was nil or not a DataStore", leaderboardName, tostring(plrName))
                        end
                    end)
                end
            end
        end
    end)
end

function LeaderboardService:GiveTrophyPetToPlayer(PlayerName)
    local Player = players:FindFirstChild(tostring(PlayerName))
    if Player ~= nil then
        spawn(function()
            PetHandler:GiveTrophyPet(Player)
        end)
    end
end 
function LeaderboardService:UpdateNumber1Player(leaderboardName, PlayerName, PlayerUserId)
    if leaderboardName ~= nil and PlayerName ~= nil and PlayerUserId ~= nil then
        if tostring(leaderboardName) == "TopEggHatch" then return end
        spawn(function()
            local npc = NPCS:FindFirstChild(tostring(leaderboardName))
            if npc == nil then
                warn("No NPC For "..tostring(leaderboardName).."!")
                return
            end
            local OwnerTag = npc:FindFirstChild("Owner")
            if OwnerTag == nil then
                OwnerTag = Instance.new("StringValue")
                OwnerTag.Name = "Owner"
                OwnerTag.Parent = npc
            end
            if OwnerTag.Value == tostring(PlayerName) then else
                local Description
                local good, fail = pcall(function()
                    Description = players:GetHumanoidDescriptionFromUserId(PlayerUserId)
                end)
                if good and not fail then
                    if Description ~= nil then
                        local humanoid = npc:FindFirstChild("Humanoid")
                        if humanoid ~= nil then
                            humanoid:ApplyDescription(Description)
                            OwnerTag.Value = tostring(PlayerName)
                        end
                    end
                else
                    warn("Error On Gett Humanoid Description From UserId: ".. tostring(PlayerUserId))
                end
            end
        end)
    end
end
local cache = {}
local function GetNameFromUserId(userId)
    if userId == nil then
        return "[ Name Didn't Load ]"
    end
    if tonumber(userId) <= 0 then
        return "[ Name Didn't Load ]"
    end
    if cache[userId] then 
        return cache[userId] 
    end
    local player = players:GetPlayerByUserId(userId)
    if player then
        cache[userId] = player.Name
        return player.Name
    end 
    local name
    local set, err = pcall(function()
        name = players:GetNameFromUserIdAsync(userId)
    end)
    if set and not err then
        cache[userId] = name
        return name
    else
        warn("Error On Getting Player Name From UserId (".. tostring(userId)..")")
    end
    return "[ Name Didn't Load ]"
end 
function LeaderboardService:UpdateLeaderboard(leaderboardName, data, parent, start)
    --[[if leaderboardName ~= nil and data ~= nil and parent ~= nil then
        local page = nil
        local Success, Err = pcall(function()
            local Data = data:GetSortedAsync(false, 100)
            page = Data:GetCurrentPage()
        end)
        if Success and not Err and page ~= nil then
            for Rank, Data in ipairs(page) do
                local UserId, Value = Data.key, Data.value
                local Name = GetNameFromUserId(UserId)
                if UserId ~= nil and Value ~= nil and Name ~= nil then
                    if tonumber(Rank) == 1 then
                        --self:UpdateNumber1Player(leaderboardName, Name, UserId)
                        if start == false then
                            --self:GiveTrophyPetToPlayer(Name)
                        end
                    end
                    --cloneUI(leaderboardName, Rank, Name, Value, parent)
                end
            end
        end
    end]]
end
function LeaderboardService:SetLeaderboardData(plr)
    if notOnLeaderboards[plr.UserId] == true or notOnLeaderboards[plr.Name] == true then else
        for _, v in pairs(leaderboardsFol:GetChildren()) do
            if v:IsA("Model") then
                local leaderboardName = v.Name
                local set, fail = pcall(function()
                    local data = getDataStore(leaderboardName)
                    if data ~= nil then
                        local amount, divTrue = getValForDataSet(plr, leaderboardName)
                        if amount ~= nil and type(tonumber(amount)) == "number" then
                            if tonumber(amount) > 0 then
                                if divTrue == true then
                                    local divAmount = divider
                                    if leaderboardName == "Rebirths" then
                                        divAmount = rebirthDivider
                                    end
                                    local setAmount = Round_Function(tonumber(amount))
                                    local newAmount = setAmount / divAmount
                                    newAmount = Round_Function(tonumber(newAmount))
                                    data:SetAsync(plr.UserId, tonumber(newAmount))
                                else
                                    local setAmount = Round_Function(tonumber(amount))
                                    data:SetAsync(plr.UserId, tonumber(setAmount))
                                end
                            end
                        else
                            errorMsg("The Amount To Set for the DataStore was nil or not a number", leaderboardName, plr.Name) 
                        end
                    else
                        errorMsg("DataStore was nil or not a DataStore", leaderboardName, plr.Name)     
                    end
                end)
                if fail and not set then 
                    errorMsg(fail, leaderboardName, plr.Name) 
                end 
                wait(1)
            end
        end
    end
end
function LeaderboardService:SetLeaderboardData(plr)
    if notOnLeaderboards[plr.UserId] == true or notOnLeaderboards[plr.Name] == true then else
        for _, v in pairs(leaderboardsFol:GetChildren()) do
            if v:IsA("Model") then
                local leaderboardName = v.Name
                local set, fail = pcall(function()
                    local data = getDataStore(leaderboardName)
                    if data ~= nil then
                        local amount, divTrue = getValForDataSet(plr, leaderboardName)
                        if amount ~= nil and type(tonumber(amount)) == "number" then
                            if tonumber(amount) > 0 then
                                if divTrue == true then
                                    local divAmount = divider
                                    if leaderboardName == "Rebirths" then
                                        divAmount = rebirthDivider
                                    end
                                    local setAmount = Round_Function(tonumber(amount))
                                    local newAmount = setAmount / divAmount
                                    newAmount = Round_Function(tonumber(newAmount))
                                    data:SetAsync(plr.UserId, tonumber(newAmount))
                                else
                                    local setAmount = Round_Function(tonumber(amount))
                                    data:SetAsync(plr.UserId, tonumber(setAmount))
                                end
                            end
else
                            errorMsg("The Amount To Set for the DataStore was nil or not a number", leaderboardName, plr.Name) 
                        end
                    else
                        errorMsg("DataStore was nil or not a DataStore", leaderboardName, plr.Name)     
                    end
                end)
                if fail and not set then 
                    errorMsg(fail, leaderboardName, plr.Name) 
                end 
                wait(1)
            end
        end
    end
end
function LeaderboardService:SetLeaderboardData(plr)
    if notOnLeaderboards[plr.UserId] == true or notOnLeaderboards[plr.Name] == true then else
        for _, v in pairs(leaderboardsFol:GetChildren()) do
            if v:IsA("Model") then
                local leaderboardName = v.Name
                local set, fail = pcall(function()
                    local data = getDataStore(leaderboardName)
                    if data ~= nil then
                        local amount, divTrue = getValForDataSet(plr, leaderboardName)
                        if amount ~= nil and type(tonumber(amount)) == "number" then
                            if tonumber(amount) > 0 then
                                if divTrue == true then
                                    local divAmount = divider
                                    if leaderboardName == "Rebirths" then
                                        divAmount = rebirthDivider
                                    end
                                    local setAmount = Round_Function(tonumber(amount))
                                    local newAmount = setAmount / divAmount
                                    newAmount = Round_Function(tonumber(newAmount))
                                    data:SetAsync(plr.UserId, tonumber(newAmount))
                                else
                                    local setAmount = Round_Function(tonumber(amount))
                                    data:SetAsync(plr.UserId, tonumber(setAmount))
                                end
                            end
else
                            errorMsg("The Amount To Set for the DataStore was nil or not a number", leaderboardName, plr.Name) 
                        end
                    else
                        errorMsg("DataStore was nil or not a DataStore", leaderboardName, plr.Name)     
                    end
                end)
                if fail and not set then 
                    errorMsg(fail, leaderboardName, plr.Name) 
                end 
                wait(1)
            end
        end
    end
end

function LeaderboardService:SetLeaderboardData(plr)
if notOnLeaderboards[plr.UserId] == true or notOnLeaderboards[plr.Name] == true then else
for _, v in pairs(leaderboardsFol:GetChildren()) do
if v:IsA(“Model”) then
local leaderboardName = v.Name
local set, fail = pcall(function()
local data = getDataStore(leaderboardName)
if data ~= nil then
local amount, divTrue = getValForDataSet(plr, leaderboardName)
if amount ~= nil and type(tonumber(amount)) == “number” then
if tonumber(amount) > 0 then
if divTrue == true then
local divAmount = divider
if leaderboardName == “Rebirths” then
divAmount = rebirthDivider
end
local setAmount = Round_Function(tonumber(amount))
local newAmount = setAmount / divAmount
newAmount = Round_Function(tonumber(newAmount))
data:SetAsync(plr.UserId, tonumber(newAmount))
else
local setAmount = Round_Function(tonumber(amount))
data:SetAsync(plr.UserId, tonumber(setAmount))
end
end


2. *[* 12:16 PM *]*

else
errorMsg(“The Amount To Set for the DataStore was nil or not a number”, leaderboardName, plr.Name)
end
else
errorMsg(“DataStore was nil or not a DataStore”, leaderboardName, plr.Name)
end
end)
if fail and not set then
errorMsg(fail, leaderboardName, plr.Name)
end
wait(1)
end
end
end
end

function LeaderboardService:LoadAnimations()
   spawn(function()
       for _, invisibleBox in pairs(InvisibleBoxes:GetDescendants()) do
           if invisibleBox:IsA("BasePart") then
               invisibleBox.Transparency, invisibleBox.CanCollide = 1, true
           end
       end
       for _, npc in pairs(NPCS:GetChildren()) do
           local anim = npc:FindFirstChildWhichIsA("Animation")
           if anim ~= nil then
               local humanoid = npc:FindFirstChild("Humanoid")
               if humanoid ~= nil then
                   local animLoaded = humanoid:LoadAnimation(anim)
                   animLoaded:Play()
               end
           end
       end
   end)
end


function LeaderboardService:StartLeaderboards(start)
   --[[local function updateLeaderboard()
       for leaderboardName, leaderboard in pairs(leaderboards) do
           if leaderboard:FindFirstChild("Board") ~= nil then
               if leaderboard:FindFirstChild("Board"):FindFirstChild("SurfaceGui") ~= nil then
                   local frameParent = leaderboard.Board.SurfaceGui.ScrollingFrame

                   for _, v in pairs(frameParent:GetChildren()) do
                       if v:IsA("Frame") or v:IsA("ImageLabel") or v:IsA("ImageButton") then
                           v:Destroy()
                       end
                   end
                   local data = getDataStore(leaderboardName)
                   if data ~= nil then
                       self:UpdateLeaderboard(leaderboardName, data, frameParent, start) wait()
                   else
                       warn(leaderboardName.." does not have a DataStore!")
                   end
               else    
                   warn(leaderboardName.." does not have a leaderboard gui inside!")
               end
           else
               warn(leaderboardName.." does not have a board inside!")
           end
       end
   end





if start == true then
       self:LoadAnimations()
       updateLeaderboard()
   else
       for _, plr in pairs(players:GetPlayers()) do
           self:SetLeaderboardData(plr)
       end
       updateLeaderboard()
   end]]
end

function LeaderboardService:CanRun()
return CAN_RUN_MODULE
end

function LeaderboardService:Initialize()
spawn(function()
self:StartLeaderboards(true) wait(1)
while true do
wait(UPDATE_TIME)
spawn(function()
self:StartLeaderboards(false)
end)
local numOfPlrs = #players:GetPlayers()
wait(5 + (numOfPlrs * waitTimePerLeaderboard))

        UpdateServerMessage += 1
        if UpdateServerMessage >= 2 then
            UpdateServerMessage = 0
            ServerChatMessagesModule:SpeakMessage(nil, nil)
        end

        UpdateGoalsCounter += 1
        
        if UpdateGoalsCounter >= 6 then
            UpdateGoalsCounter = 0
            
            --CommunityGoalsModule:SetBoard()
        end
    end
end)

end

return LeaderboardService

Uhhh…Your code is too long which shouldn’t be just for a leaderboard, but that’s nof the problem, also we really don’t know what’s the script inside the modules.

i can send the other sirpts the gem and rebirth ones tho

1 Like

Yeah, you may send it because I can’t really understand what’s your code because at some points you used modules and Idk what’s the script inside modules

What I suggest is the function where you are adding the lists of players, just wait every 180 seconds and add the function, if there’s complexity in your code, it will error alot

yeah, i didnt made this main code tho, it was the scripter that was hired, but the code isnt really working, it used to

local OrderedDataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Rebirths")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local RepModules = ReplicatedStorage:WaitForChild("Modules")
local Abbreviate = require(RepModules.Abbreviate)
local Tablero = script.Parent
local Boards = Tablero:WaitForChild("Board")
local Aqui = Boards.Aqui
local Npc = Tablero.Npc
local Holder = Aqui.Jugadores
local CurrencyName = "Rebirths"

local List = 100
local Esperar = 60


function Main ()
	local Success, Error = pcall(function()
		local Pages = OrderedDataStore:GetSortedAsync(false, List)
		local Data = Pages:GetCurrentPage()

		for i, v in ipairs(Data)do
			--print(i)
			--print(v.key)
			local Frame =ServerStorage.ItemStorage.Extra.LeaderboardFrame:Clone()

			Frame.PlayerName.Text = v.key
			Frame.Rank.Text = "#"..i--tostring(i)
			Frame.Name = v.key
			Frame.LayoutOrder = i --tonumber(i)
			Frame.BackgroundColor3 = Color3.fromRGB(189, 136, 0)

			if i == 1 then
				local id = game.Players:GetUserIdFromNameAsync(v.key)
				local des = game.Players:GetHumanoidDescriptionFromUserId(id) 
				local hum = Npc.Humanoid
				hum:ApplyDescription(des)
			end
			Frame.Amount.Text = Abbreviate:ReturnShort(tonumber(v.value))
			Frame.Visible = true
			Frame.Parent = Holder
		end
	end)
	if not Success and Error then
		error(Error)
	end
end

while true do
	for _, Player in pairs(game.Players:GetPlayers())do
		local PlayerValue = Player.Fake[CurrencyName]

		OrderedDataStore:SetAsync(Player.Name, PlayerValue.Value)
	end
	for _, v in pairs(Holder:GetChildren())do
		if v.ClassName == "Frame"  then
			v:Destroy()
		end
	end
	Main()
	task.wait(Esperar)
end```

ooo aigh i m check that
btw the rest of th code

local OrderedDataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Gems")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local RepModules = ReplicatedStorage:WaitForChild("Modules")
local Abbreviate = require(RepModules.Abbreviate)
local Tablero = script.Parent
local Boards = Tablero:WaitForChild("Board")
local Aqui = Boards.Aqui
local Npc = Tablero.Npc
local Holder = Aqui.Jugadores
local CurrencyName = "Gems"

local List = 100
local Esperar = 60


function Main ()
	local Success, Error = pcall(function()
		local Pages = OrderedDataStore:GetSortedAsync(false, List)
		
		local Data = Pages:GetCurrentPage()
		print(Data)

		for i, v in ipairs(Data)do
			--print(i)
			--print(v.key)
			local Frame =ServerStorage.ItemStorage.Extra.LeaderboardFrame:Clone()

			Frame.PlayerName.Text = v.key
			Frame.Rank.Text = "#"..i--tostring(i)
			Frame.Name = v.key
			Frame.LayoutOrder = i --tonumber(i)
			Frame.BackgroundColor3 = Color3.fromRGB(189, 136, 0)

			if i == 1 then
				local id = game.Players:GetUserIdFromNameAsync(v.key)
				local des = game.Players:GetHumanoidDescriptionFromUserId(id) 
				local hum = Npc.Humanoid
				hum:ApplyDescription(des)
			end
			
			Frame.Amount.Text = Abbreviate:ReturnShort(tonumber(v.value))
			
			print("=========")
			Frame.Visible = true
			Frame.Parent = Holder
		end
	end)
	if not Success and Error then
		error(Error)
	end
end

while true do
	for _, Player in pairs(game.Players:GetPlayers())do
		local PlayerValue = Player.Fake[CurrencyName]

		OrderedDataStore:SetAsync(Player.Name, PlayerValue.Value)
	end
	for _, v in pairs(Holder:GetChildren())do
		if v.ClassName == "Frame"  then
			v:Destroy()
		end
	end
	Main()
	task.wait(Esperar)
end```

Hmmm…The script your scripter made is like overcomplexity though, leaderboards are very easy, I have made several leaderboards easily

This is fine, but can you please highlight the code where it needs to refresh ?

yeah, the ones i ve previously made were way smaller scripts

the gems, have a limit which is what i saw o the picture, and the rebirths arent refershing

i think i know the mistake, the datastorage isnt working very well im check that out