Why does my Global Leaderboard update on studio, but not on a server?
Lets start off with the code to get the code in your mind.
01 | ods = game:GetService( "DataStoreService" ):GetOrderedDataStore( "BinaryBashGlobalLeaderboardLevels" ) |
03 | function updateBoard(board, data) |
04 | for index, child in ipairs (data) do |
06 | local name = child.key |
07 | local score = child.value |
08 | local dispname = board.PlayerNames:FindFirstChild( "Name" ..pos) |
09 | local dispval = board.PlayerScores:FindFirstChild( "Score" ..pos) |
10 | dispname.Text = tostring (name:sub( 8 )) |
11 | dispval.Text = tostring (score) |
15 | coroutine.resume(coroutine.create( function () |
16 | while wait(( 5 + game.Players.NumPlayers * 2 )/ 60 ) do |
17 | local pages = ods:GetSortedAsync( false , 10 ) |
18 | local data = pages:GetCurrentPage() |
19 | updateBoard(script.Parent.Leaderboard, data) |
23 | print ( "Still running after the loop! Woo!" ) |
24 | while wait(( 60 + game.Players.NumPlayers * 10 )/ 60 ) do |
25 | for i, plr in pairs (game.Players:GetChildren()) do |
26 | local key = "player-" .. plr.Name |
27 | local newStat = plr.leaderstats.Levels.Value |
28 | ods:SetAsync(key, newStat) |
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!