How would I get a player's Friend Count?

I made a player statistics GUI, and I got the account age working, but I can’t figure out how to get a player’s friend count.
image
I already looked through the old and new Creator Documentations, but it seems that the player:GetFriendsAsync() is somewhat deprecated? (it doesn’t say that, but seeing as there is no other documentation about it, I assume it is.)

Is there an easier way to do this or is it just impossible?
Any help is appreciated, thanks!

Hi Ive made some research on this and found this Players:GetFriendsAsync Tell me if it helped or not

You could use ROBLOX’s API to return a player’s friend count. I can attempt to help with this if needed/if you want to use it instead.

Friends Api (roblox.com)

I’m not that great a scripter :sweat_smile:. How do I use this program?

1 Like

I tried this, but it didn’t work because I thought it was deprecated and also it doesn’t have a return value for Friend Count.

W-w-w-w-what d-d-do you mean…:flushed:

I sent you a DM on the application outside of roblox that starts with a d and ends with a d

This is the better solution as it doesn’t require the ‘HttpService’.

local Game = game
local Players = Game:GetService("Players")

local Success, Result = pcall(function() return Players:GetFriendsAsync(261) end)
if Success then
	local Friends = 0
	while true do
		Friends += #Result:GetCurrentPage()
		if Result.IsFinished then break else Result:AdvanceToNextPageAsync() end
	end
	print(Friends) --98
else
	warn(Result)
end
3 Likes

ok but why did you do local Game = game, thats so pointless :sob:

2 Likes