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

Can someone explain why this Ordered DataStore script isn't working correctly?

Asked by
sgsharp 265 Moderation Voter
9 years ago

Overview:

This Ordered DataStore script works perfectly fine when I am Playing Solo in studio, but when I am playing the game with the ROBLOX player, I keep getting this in the output, HTTP 503 (Please retry after a few minutes), and it keeps breaking at line 27 of the code.

Did I do something wrong? How can I fix this? Why does it keep telling my to try again in a few minutes on the client, but not studio?

Code:

local ods = game:GetService("DataStoreService"):GetOrderedDataStore("KillBoard")

function updateBoard(board, data)
    for k,v in pairs(data) do
        local pos = k
        local name = v.key
        local score = v.value
        local positionbox = board:FindFirstChild("P" .. pos)
        local nametextbox = positionbox:FindFirstChild("Name")
        nametextbox.Text = name     
        local scoretextbox = positionbox.Kills
        scoretextbox.Text = score

    end 
end

function updateGui()
    for i, v in pairs(game.Players:GetPlayers()) do
    local UI = game.Workspace.LeaderSign.Screen.Gui.Leaderboard
    UI:Clone().Parent = v.PlayerGui.Main.Screen
    UI.Visible = false
    end

end

while true do   
    local pages = ods:GetSortedAsync(false, 5)
    local data = pages:GetCurrentPage()
    updateBoard(game.Workspace.LeaderSign.Screen.Gui.Leaderboard.List1, data)
    updateGui()
    if not pages.IsFinished then
        pages:AdvanceToNextPageAsync()
        data = pages:GetCurrentPage()
        updateBoard(game.Workspace.LeaderSign.Screen.Gui.Leaderboard.List2, data)
    end
    wait(.1)
end

Answer this question