Lets start off with the code to get the code in your mind.
ods = game:GetService("DataStoreService"):GetOrderedDataStore("BinaryBashGlobalLeaderboardLevels")
function updateBoard(board, data)
for index, child in ipairs(data) do
local pos = index
local name = child.key
local score = child.value
local dispname = board.PlayerNames:FindFirstChild("Name"..pos)
local dispval = board.PlayerScores:FindFirstChild("Score"..pos)
dispname.Text = tostring(name:sub(8))
dispval.Text = tostring(score)
end
end
coroutine.resume(coroutine.create(function()
while wait((5 + game.Players.NumPlayers * 2)/60) do
local pages = ods:GetSortedAsync(false, 10)
local data = pages:GetCurrentPage()
updateBoard(script.Parent.Leaderboard, data)
end
end))
print("Still running after the loop! Woo!")
while wait((60 + game.Players.NumPlayers * 10)/60) do
for i, plr in pairs (game.Players:GetChildren()) do
local key = "player-" .. plr.Name
local newStat = plr.leaderstats.Levels.Value
ods:SetAsync(key, newStat)
end
end
The issue is whenever I test this in studio, the Global Leaderboard updates relatively quick. I use the algorythms from the Roblox Wiki that tell me the limitations for the speed the Global Leaderboard can update per minute per server.
The momment I go into a server, it says that it is updating, no errors, but - It doesn't update.
Whoever knows the issue please answer this!
EDIT: I just logged onto a server, but since this is a new server the leaderboard is up-to-date. So the script works once??? I just thought I would let you guys know incase there would be a different issue.
Sincerely, jmanrock123
P.S: Thanks to whoever helped in advance!
