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

Looping through a DataStore?

Asked by
Vrakos 109
10 years ago

How would I go about doing this? I've tried :GetOrderedDatasStore() and I get error 503

This is the current code:

function Variables.RemoteFunctions.CheckSearch:OnServerInvoke(Player, Param)
    local Results = {}
    local Pages = game:service("DataStoreService"):GetOrderedDataStore("db_profiles"):GetSortedAsync(false, 0, 10000)
    for Index,Data in pairs(Pages:GetCurrentPage()) do
        if #Results < 8 then
            if Data.key:lower():sub(1,#Param) == Param:lower() then
                table.insert(Results, Data.key)
            end
        else
            break
        end
    end
    print(tostring(#Results))
    return Results
end

1 answer

Log in to vote
0
Answered by 10 years ago

503 is the HTML error code for "Service Unavailable". Perhaps roblox.com's data store repository was down when you tried the snippet, or perhaps you're trying it from playing solo (I don't know the exact behavior of data stores from Studio).

0
I'm testing in online mode. Vrakos 109 — 10y
Ad

Answer this question