Issues with :ListKeysAsync

i have a datastore, lets call it DataStore001.
i have some saved keys in it and i want to get them all with :ListKeysAsync()
if i print it it prints only “Instance”
if i use :GetAsync it prints the name of the Key.

is there a way, that ListKeysAsync() prints the key name?

thanks for your support

It’s printing “Instance” because the :ListKeysAsync() method returns a DataStoreVersionPages Instance not a table. You’ll need to do this to read the data inside your DataStore correctly:

local DataStoreService = game:GetService("DataStoreService")

local DataStore = DataStoreService:GetDataStore("DataStore001") -- Change this to match the name you want to use

local success, pages = pcall(DataStore.ListKeysAsync, DataStore)

if success then
	while true do
		local items = pages:GetCurrentPage()

		for index, dataStoreKey in items do
			local success, value = pcall(DataStore.GetAsync, DataStore, dataStoreKey.KeyName)

			if success then print(value) end
		end

		if pages.IsFinished then break end
		pages:AdvanceToNextPageAsync()
	end
end

yeah it works, but its only do print a maximum of 3 Values

If you only have 3 values stored inside the DataStore, then only 3 values will be printed

Make sure there isn’t a problem with how your saving values within the DataStore that’s preventing values from being stored correctly