How to get a table of a players followers

What’s wrong with this block of code?

local FriendFollowers = {}
for AFollower, PageNumber in HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(Player.Name)).."/followers/")) do
	table.insert(FriendFollowers, AFollower.Username)
	print(AFollower.Username)
end
3 Likes

Have you bothered checking at all what the properties of “AFollower” is. If you check the contents then you can see how to interact with it. If nothing appears then that means the code isn’t running because your request returned nothing meaning you’re not using a valid/correct endpoint or the (assuming its public) proxy failed to handle the request.

How would I check the properties then?

for i,v in pairs(AFollower) do
print(i…" - "…v)
end

It errors on line 2 though

for AFollower, PageNumber in HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(Player.Name)).."/followers/")) do

“attempt to call a table value”

you only put “in myTable” do in pairs

this is all of it if you were wondering

-- Check which friends follow the player and which friends the player follows
local UpTo = 1
local FriendsFollowingPlayer = {}
local PlayerFollowingFriends = {}
local FollowingEachother = {}
while UpTo <= NumberOfFriends do
	local CheckFriend = Friends[UpTo]
	for FollowingUser, PageNumber in HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(CheckFriend)).."/followers/")) do
		if FollowingUser.name == Player.Name then
			table.insert(PlayerFollowingFriends, CheckFriend)
		return end
	end
	for AFollower, PageNumber in HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(Player.Name)).."/followers/")) do
		if AFollower.name == CheckFriend then
			table.insert(FriendsFollowingPlayer, Player.Name)
		return end
	end
	UpTo = UpTo + 1
	wait()
end

What? Like this? for i, v in pairs (PageNumber in HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(Player.Name)).."/followers/"))) do

I just ran your code. “AFollower” is a string datatype not a table. and it’s only giving me two values
image

Would you be willing to write a working version (that can get followers names)?

image

local FriendFollowers = {}
myTable = game:GetService("HttpService"):GetAsync("https://friends.roproxy.com/v1/users/"..(game.Players:GetUserIdFromNameAsync("DevGr8M8")).."/followers")
myTable = game:GetService("HttpService"):JSONDecode(myTable)
for i,v in pairs(myTable["data"]) do
	print(v["name"])
	if v["displayname"] ~= nil then
		print(v["displayname"])
	end
	print(v["id"])
end

adaption of your code would be

	for AFollower, PageNumber in pairs HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(Player.Name)).."/followers/"))["data"] do
	if AFollower["name"] == CheckFriend then
		table.insert(FriendsFollowingPlayer, AFollower["name"])
		return end
      end
end

in future if you want to be able to do other stuff like this check roblox endpoints and see how the response content is laid out e.g

below is correct and i HIGHLY don’t recommend doing this for followers as followers/following can be botted/6-7 digits making it take a absurd amount of time to function to its proper intent making is ultimately useless especially for people who have legitimate followings and are somewhat famous

1 Like

There are multiple things you need to do.

This endpoint has a limit on how many followers it will display.
You need to make a table, add the followers of one page to the table, then keep making requests with the next page cursor that you get from the previous request. Once you do that, you’ll need to make a loop and check for what you’re wanting to check for, then you need to do the whole process again for the other user.

Overall, there’s no way to really do it efficiently. Unless you’re willing to make back-to-back requests and risk getting rate limited, I wouldn’t do it.

1 Like

This all relies on the person having under 100 followers as that is the highest limit for one request.

1 Like

For example, if you do this on me, you’d have to make 7 back-to-back requests just to get all my followers. Then let’s assume the other person also has over 600 followers, you’d have to do 7 requests for them as well making it 14 requests you’re doing.

1 Like

Thanks for the info. It’s just for a silly game which would scan a players friends and followers / following to determine who their closest Roblox friend would be, nothing needs to be perfect anyways - I’ve already added this as a warning


This exists if you want to see if somebody is following you currently.

for PlayerFollowing, PageNumber in pairs (HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(CheckFriend)).."/followers/"))["data"]) do
				print(PlayerFollowing["name"])
				if PlayerFollowing["name"] == Player.Name then
					table.insert(PlayerFollowingFriends, CheckFriend)
				return end
			end

errored “attempt to index number with name”

swap around playerfollowing and pagenumber whoops lol

for index, AFollower in pairs HTTP:JSONDecode(HTTP:GetAsync("https://friends.roproxy.com/v1/users/"..(Players:GetUserIdFromNameAsync(Player.Name)).."/followers/"))["data"] do
	if AFollower["name"] == CheckFriend then
		table.insert(FriendsFollowingPlayer, AFollower["name"])
		return end
end
1 Like

Last thing, how would I request it again without including the same followers already scanned?

use this
read the comment area to see op’s usage example. based off skim reading this should handle rate limits by waiting the exact timelength until another request can be sent without getting denied (after being denied) dont know if that will skip a page or user as i haven’t ever used roblox endpoints. @OreoTec_h will probably mention something if there is an issue with it skipping