Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Why does my Global Leaderboard update on studio, but not on a server?

Asked by
Azmidium 388 Moderation Voter
9 years ago

Lets start off with the code to get the code in your mind.

01ods = game:GetService("DataStoreService"):GetOrderedDataStore("BinaryBashGlobalLeaderboardLevels")
02 
03function updateBoard(board, data)
04    for index, child in ipairs(data) do
05        local pos = index
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)
12    end
13end
14 
15coroutine.resume(coroutine.create(function()
View all 30 lines...

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!

1 answer

Log in to vote
1
Answered by
Legojoker 345 Moderation Voter
9 years ago

Change the wait in the coroutine on line 16 to

1wait(60/(8+game.Players.NumPlayers * 1.5))

this should keep the data store service from screaming at you for not giving it enough time to breath.

Ad

Answer this question