Actually, what I’m trying to do is create a functional GlobalLeaderboard that refreshes every 10 seconds and then lists the top users of that data. My leaderstats script is a little disorganized, albeit some of it actually functions. I’m not sure what the problem is.
So allow me to clarify for you. LeaderstatsStorage is the first of the two DataStores I developed, and GlobalLeaderboardFix is the name of the second. If a player is brand-new to the game by default, they will immediately receive 0 of the seven values that the LeaderstatsStorage saves from an IntValue. This portion functions flawlessly; however, the script for the global leaderboard is broken. In order to make this work, the GlobalLeaderboardFix value is set to the first IntValue of the DataStore named Money. I checked to see if it had the values preserved, and it does. As I utilized the printing method for debugging before posting this to hunt for a solution on my own, it printed exactly the value it had.
But then, the part where the Global Leaderboard-script comes in, it does not really work. It does not clone the TextLabel named Template into a Frame called Holder, and that’s where it does not work. I belive my error starts where it gets all the information about the DataStore in the Global Leaderboard script.
The Global Leaderboard-script, however, does not truly function after it is introduced. Where it fails is when trying to copy the TextLabel named Template into a Frame named Holder. I think my mistake first appears in the Global Leaderboard script, which is where it gathers all the data about the DataStore.
LeaderStats (ServerScriptService)
--// Variables
local Players = game:GetService("Players");
local DataStoreService = game:GetService("DataStoreService");
local LeaderstatStorage = DataStoreService:GetDataStore("LeaderstatStorage")
local GlobalLeaderboardFix = DataStoreService:GetDataStore("GlobalLeaderboardFix")
Players.PlayerAdded:Connect(function(Player)
local result = nil
local success, err = pcall(function()
result = LeaderstatStorage:GetAsync(Player.UserId)
end)
if not result then
local StatTable = {0, 0, 0, 0, 0, 0, 0}
LeaderstatStorage:SetAsync(Player.UserId, StatTable)
end
local GLF = GlobalLeaderboardFix:GetAsync(Player.UserId)
if GLF then
print(GLF)
end
local LeaderstatsFolder = Instance.new("Folder", Player)
LeaderstatsFolder.Name = "leaderstats"
local Money = Instance.new("IntValue", LeaderstatsFolder)
Money.Name = "Money"
Money.Value = result[1]
local Rebirths = Instance.new("IntValue", LeaderstatsFolder)
Rebirths.Name = "Rebirths"
Rebirths.Value = result[2]
local Multiplier = Instance.new("IntValue", LeaderstatsFolder)
Multiplier.Name = "Multiplier"
Multiplier.Value = result[3]
local Ultra = Instance.new("IntValue", LeaderstatsFolder)
Ultra.Name = "Ultra"
Ultra.Value = result[4]
local Mega = Instance.new("IntValue", LeaderstatsFolder)
Mega.Name = "Mega"
Mega.Value = result[5]
local Prestige = Instance.new("IntValue", LeaderstatsFolder)
Prestige.Name = "Prestige"
Prestige.Value = result[6]
local Levelc = Instance.new("IntValue", LeaderstatsFolder)
Levelc.Name = "Levelc"
Levelc.Value = result[7]
end)
Players.PlayerRemoving:Connect(function(Player)
LeaderstatStorage:SetAsync(Player.UserId, {Player:WaitForChild("leaderstats").Money.Value, Player:WaitForChild("leaderstats").Rebirths.Value, Player:WaitForChild("leaderstats").Multiplier.Value, Player:WaitForChild("leaderstats").Ultra.Value, Player:WaitForChild("leaderstats").Mega.Value, Player:WaitForChild("leaderstats").Prestige.Value, Player:WaitForChild("leaderstats").Levelc.Value})
GlobalLeaderboardFix:SetAsync(Player.UserId, Player:WaitForChild("leaderstats").Money.Value)
end)
GlobalLeaderboard (ServerScriptService)
----- Variables -----
local Players = game:GetService("Players");
local DataStoreService = game:GetService("DataStoreService");
local GlobalLeaderboardFix = DataStoreService:GetOrderedDataStore("GlobalLeaderboardFix");
local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = GlobalLeaderboardFix:GetSortedAsync(false, 50)
local CurrentPage = Data:GetCurrentPage()
for Rank, data in ipairs(CurrentPage) do
local Name = Players:GetNameFromUserIdAsync(tonumber(data.key))
local Username = Name
local CurrentData = data.value
local OnLeaderboard = false
for i,v in pairs(workspace.GlobalLeaderboard.SurfaceGui.ScrollingFrame.Holder:GetChildren()) do
if v.Player.Text == Username then
OnLeaderboard = true
break
end
end
if CurrentData and OnLeaderboard == false then
local NewFrame = workspace.GlobalLeaderboard.SurfaceGui.Template:Clone()
NewFrame.Name = Username
NewFrame.Parent = workspace.GlobalLeaderboard.SurfaceGui.ScrollingFrame.Holder
NewFrame.Text = Rank .. " - " .. Username .. " - " .. CurrentData
end
end
end)
if not success then
print(errorMessage)
end
end
while true do
for _, frame in pairs(workspace.GlobalLeaderboard.SurfaceGui.ScrollingFrame.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
print("Refreshed Global Leaderboard")
task.wait(10)
end
Leaderboard Part (Workspace - Explorer View)

Any responses that provide helpful details regarding how to solve this issue are much appreciated.