Currently, Players:GetFriendsAsync() only returns 50 friends, even after iterating through all pages. This has been causing issues in my game and it was first reported by players 2 days ago (10/23).
The code used is the one from the documentation, which is supposed to return a table of ALL friends.
Here is the code:
local Players = game:GetService("Players")
local USERNAME = "Headstackk"
local function iterPageItems(pages)
return coroutine.wrap(function()
local pagenum = 1
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
-- First, get the user ID of the player
local userId = Players:GetUserIdFromNameAsync(USERNAME)
-- Then, get a FriendPages object for their friends
local friendPages = Players:GetFriendsAsync(userId)
-- Iterate over the items in the pages. For FriendPages, these
-- are tables of information about the friend, including Username.
-- Collect each username in a table
local usernames = {}
for item, _pageNo in iterPageItems(friendPages) do
table.insert(usernames, item.Username)
end
print(#usernames, usernames)
And the output shows a table with only 50 friends.
50 ▼ {
[1] = "OMGIsPerry",
[2] = "transquilleo",
[3] = "Valkyrixk",
[4] = "MengyamR2D",
[5] = "oTheSilver",
[6] = "maxgenadiy",
[7] = "TToAnnihilate",
[8] = "pulledupinnabeamer",
[9] = "TheDomshoe",
[10] = "PannRBLX",
[11] = "TheKowloonPeak",
[12] = "spylol911",
[13] = "Auptnue",
[14] = "marisawins",
[15] = "Mr_EliteReturned",
[16] = "SanserioP",
[17] = "CrazyCodeX",
[18] = "Strivian",
[19] = "TheDiamondDrone",
[20] = "ELEVEN_BILL",
[21] = "nici_lp",
[22] = "ToppatNoob",
[23] = "Tatt_27",
[24] = "Peeperushki",
[25] = "AragenTrevino",
[26] = "jjsam07",
[27] = "Capra_K",
[28] = "A_Renegade",
[29] = "C9Z9",
[30] = "Hyorc",
[31] = "WindyEvolution",
[32] = "Xurnz",
[33] = "zec105",
[34] = "ikepik3",
[35] = "o_Corp",
[36] = "AyPandaa",
[37] = "Fr0stByt3X",
[38] = "lakeinsilvano",
[39] = "HKmedlc",
[40] = "ImChompo",
[41] = "asfarasyoucan",
[42] = "funnyobesewalk",
[43] = "iGottic",
[44] = "Risyari",
[45] = "GoSinister",
[46] = "HowsLifeJosh",
[47] = "xOATLEAFx",
[48] = "superiorToYourMayo",
[49] = "RK800ConnorMkI",
[50] = "dekbimo"
}
Expected behavior
GetFriendsAsync() should return ALL friends of a user.