How do you get info about a player from a ID?

Hi! Im making a roblox game, how do you get info like when the player joined, the amount of followers and friends?

2 Likes

There is a Player class.

I know, but the player has to be in-game.

There is an API too.

You could probably use HTTPService to obtain the Player’s Data from a external weblink outside of ROBLOX, but your question seems a bit vague so I’m unsure what you exactly want to get about the “Player’s Info”

You’d need a proxy to use the friends API which contains follower count.

https://friends.roblox.com/docs

How do you use that API? I just need followers and friends count.

There isn’t a clear way that gives you the count.

You can use Players:GetFriendsAsync to get the friends and then count them, but idk if there’s a way to get followers.

You can count the table that GetFriendsAsync will give you:

local Success,Pages = pcall(function()
	return game.Players:GetFriendsAsync(UserId)
end)
if not Success then		print("Error:",Pages)		end

local Friends = {}
while true do
	for _, item in ipairs(Pages:GetCurrentPage()) do
		table.insert(Friends,item)
	end
	if Pages.IsFinished then		break		end
	Pages:AdvanceToNextPageAsync()
end
print(#Friends)
Or this
local URL = "https://friends.rprxy.xyz/v1/users/UserId/friends/count"
Data = game.HttpService:GetAsync(URL)
Data = game.HttpService:JSONDecode(Data).count

And for followers use this:

local URL = "https://friends.rprxy.xyz/v1/users/UserId/followers/count"
Data = game.HttpService:GetAsync(URL)
Data = game.HttpService:JSONDecode(Data).count
1 Like

The response above could work, and in terms of uncertainty, as rprxy is an open-source proxy that’s accessible to everyone - causing traffic issues which would lead to errors getting your followers due to “Too Many Requests”.

Besides, you could use the source code used above for getting friends, but it can be also obtained by a proxy:

--Script in ServerScriptService
--[ Variables
local http = game:GetService("HttpService"); local ps = require(script.ProxyService)
local proxy = ps:New("YourHerokuDomain", "YourHerokuKey")
local api = "https://friends.roblox.com"
local userId = 121227196 --Doqee
--[ Setup
local friends = proxy:Get(api.."/v1/users/"..userId.."/friends/count").body
local followers = proxy:Get(api.."/v1/users/"..userId.."/followers/count").body
friends = http:JSONDecode(friends).count; followers = http:JSONDecode(followers).count
print(friends, followers) --outputs as "180, 3,544" (friends, followers)

For this to work, you must:

  • create a module, named ProxyService with this code, then parent it to the Script.

  • create an account for HerokuApp.

  • follow the tutorial in order to get your Domain and Key (required parameters as seen in line 4).

A bit latter but any alternatives to that proxy.