To go to the next page, use AdvanceToNextPageAsync, UNLESS IsFinished is true, in which case, assume that all data in the Pages object has been handled
do
local Success, Result = pcall(function() Players:GetFriendAsync(1) end)
if not Success then warn(Result) return end
local Page = Result:GetCurrentPage()
repeat
for Index, PageItem in ipairs(Page) do
print(PageItem.Id) --Index page item's 'ID' field.
end
if not Result.IsFinished then Result:AdvanceToNextPageAsync() end
until Result.IsFinished
end
Once you’ve retrieved a single ‘page’ from the ‘pages’ object you can iterate over its items and print each item’s ‘Id’ field.