Players:GetFriendsAsync() limits

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.

2 Likes

Hi iiPiecha, welcome to the DevForum community!

Regarding your issue, this is likely due to Roblox having a cap at 200 friends per user. I can’t see any problems with the code you provided.

Hope this helps.

1 Like

Wrong place, you’d better move it here, I mean the theme/topics: #platform-feedback:engine-bugs or #platform-feedback:studio-bugs

It has not been established if this is a bug, or intentional.
Additionally, callout posts should typically be in DMs.

5 Likes