local CoinsLeaderboard = DataSoreService:GetOrderedDataStore(“CoinsLeaderboard”)
local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
local CoinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(CoinsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Coins = 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
break
end
end
if Coins and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild(“LeaderboardFrame”):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Coins.Text = Coins
newLbFrame.Rank.Text = “#”…Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end
end
end)
if not success then
print(errorMessage)
end
end
while true do
for _, player in pairs(game.Players:GetPlayers()) do
CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
end
for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
wait(10)
end
local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
local CoinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(CoinsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Coins = 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
break
end
end
if Coins and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Coins.Text = Coins
newLbFrame.Rank.Text = "#"…Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end
end
if not success then
print(errorMessage)
end
end
while true do
for _, player in pairs(game.Players:GetPlayers()) do
CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
end
for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
wait(10)
end
end
local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
local CoinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(CoinsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Coins = 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
break
end
end
if Coins and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild(“LeaderboardFrame”):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Coins.Text = Coins
newLbFrame.Rank.Text = “#”…Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end
end
if not success then
print(errorMessage)
end
end
while true do
for _, player in pairs(game.Players:GetPlayers()) do
CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
end
for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
wait(10)
end
end
ServerScriptService.LeaderboardHandler:22: Expected identifier when parsing expression, got Unicode character U+2026 (did you mean ‘…’?) - Studio - LeaderboardHandler:22
local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
local CoinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(CoinsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Coins = 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
break
end
end
if Coins and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild(“LeaderboardFrame”):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Coins.Text = Coins
newLbFrame.Rank.Text = “#”…Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end
end
if not success then
print(errorMessage)
end
end
while true do
for _, player in pairs(game.Players:GetPlayers()) do
CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
end
for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
wait(10)
end