Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Looping through a DataStore?

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

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).

1 comment

0

I'm testing in online mode.

This discussion is preserved as it was. New answers, comments, and votes are closed.