So i was experimenting with the Players:GetFriendsAsync() function, but it seems like it has a limit of 50 FriendPages.
I do not know why it has a limit, i even tried to get past it but it didnt work.
Code
local Players = game:GetService("Players")
local USERNAME = "iiPiecha"
local function iterPageItems(pages, startPage)
return coroutine.wrap(function()
local pagenum = startPage
while true do
for _, item in ipairs(pages:GetCurrentPage()) do
coroutine.yield(item, pagenum)
end
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
pagenum = pagenum + 1
end
end)
end
local userId = Players:GetUserIdFromNameAsync(USERNAME)
local friendPages = Players:GetFriendsAsync(userId)
local usernames = {}
for item, pageNo in iterPageItems(friendPages, 50) do
table.insert(usernames, item.Username)
end
print("Friends of " .. USERNAME .. ": ".. table.concat(usernames, ", \n"))
Even through the first page number is 50, the iterPageItems() function loads the FriendPages from 1 to 50.
I really have no idea why this happens.