Get player's bio using API

Hello everyone!

Right now, I would like to know something: How would I get a player’s bio using HTTPService.

Here is my current script:

local HttpService = game:GetService("HttpService") 

game.ReplicatedStorage.Check.OnServerEvent:Connect(function(UserWhoCalled,UserName)
	local playerStatus
	local bio
	local function status(username, id)
		local URL = "https://www.rprxy.xyz/users/"..id.."/profile"
		local user = HttpService:GetAsync(URL, true)

		if (string.find(user, "icon%-game") ~= nil) then
			playerStatus = "in a game"
		elseif (string.find(user, "icon%-online") ~= nil) then
			playerStatus = "online"
		elseif (string.find(user, "icon%-studio") ~= nil) then
			playerStatus = "in studio"
		else
			playerStatus = "offline"
		end
	end
	
	local function getPlayerBio(id)
		local URLe = "https://www.rprxy.xyz/users/"..id.."/profile"
		local user = HttpService:GetAsync(URLe, true)
		
		if (string.find(user, "profile%-about-content-text linkify") ~= nil) then
			bio = string.find(user, "profile%-about-content-text linkify")
			print(bio)
		end
	end

	local URL1 = "https://api.rprxy.xyz/users/get-by-username?username="..UserName -- API that you want to get from
	local URL2 = "http://friends.rprxy.xyz/v1/users/"..game.Players:GetUserIdFromNameAsync(UserName).."/friends/count"
	
	local Response = HttpService:GetAsync(URL1)
	local Data = HttpService:JSONDecode(Response)
	local Response2 = HttpService:GetAsync(URL2)
	local Data2 = HttpService:JSONDecode(Response2)

	script.Parent.Loading.Visible = true
	script.Parent.Loading.Text = "Loading "..UserName.."'s stats, please wait."

	script.Parent.Box.Visible = false

	getPlayerBio(game.Players:GetUserIdFromNameAsync(UserName))
	status(UserName, game.Players:GetUserIdFromNameAsync(UserName))

	Rest of code was hidden

As you can see, I use a function to get the player’s bio but it doesn’t work, I am very new to getting HTML out of pages and I would like some help here.

(To quick reply, press LSHIFT + R)

3 Likes

Good Morning!

To get the bio of a Roblox player within your code, you’ll need to utilize this endpoint: https://users.roblox.com/v1/users/THEIR_ID as documented here.

As you already know, you’ll need to lump this endpoint into your rbrxy.xyz API if it’s not already to make it function as intended.

Hopefully this helps!

1 Like

Wait, this actually didn’t work. I tried the code to get the description but it says it’s nil. Here is the script:

local HttpService = game:GetService("HttpService") 

game.ReplicatedStorage.Check.OnServerEvent:Connect(function(UserWhoCalled,UserName)
	local playerStatus
	local bio
	local function status(username, id)
		local URLToGetStatus = "https://www.rprxy.xyz/users/"..id.."/profile"
		local user = HttpService:GetAsync(URLToGetStatus, true)

		if (string.find(user, "icon%-game") ~= nil) then
			playerStatus = "in a game"
		elseif (string.find(user, "icon%-online") ~= nil) then
			playerStatus = "online"
		elseif (string.find(user, "icon%-studio") ~= nil) then
			playerStatus = "in studio"
		else
			playerStatus = "offline"
		end
	end
	
	local function getPlayerBio(id)
		local URLToGetBio = "https://users.rprxy.xyz/v1/users/"..id
		
		local Response = HttpService:GetAsync(URLToGetBio)
		local Data = HttpService:JSONDecode(Response)
		
		local bio = Data.description
	end

	local URL1 = "https://api.rprxy.xyz/users/get-by-username?username="..UserName -- API that you want to get from
	local URL2 = "http://friends.rprxy.xyz/v1/users/"..game.Players:GetUserIdFromNameAsync(UserName).."/friends/count"
	
	local Response = HttpService:GetAsync(URL1)
	local Data = HttpService:JSONDecode(Response)
	local Response2 = HttpService:GetAsync(URL2)
	local Data2 = HttpService:JSONDecode(Response2)

	script.Parent.Loading.Visible = true
	script.Parent.Loading.Text = "Loading "..UserName.."'s stats, please wait."

	script.Parent.Box.Visible = false

	getPlayerBio(game.Players:GetUserIdFromNameAsync(UserName))
	status(UserName, game.Players:GetUserIdFromNameAsync(UserName))

	script.Parent.Player.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..game.Players:GetUserIdFromNameAsync(UserName).."&width=420&height=420&format=png"

	script.Parent.Online.Text = UserName.." is "..playerStatus
	script.Parent.Description.Text = bio -- Says this is nil?
	script.Parent.ID.Text = UserName.."'s ID is "..Data.Id
Players.MrOofBoyPlayz.PlayerGui.Checker.Frame.Step2:49: invalid argument #3 (string expected, got nil)
Stack Begin
Script 'Players.MrOofBoyPlayz.PlayerGui.Checker.Frame.Step2', Line 49
Stack End
Server Kick Message: You were kicked from this game: You was on the loading screen for too long and you were kicked.

The kick message happens if the player is stuck on the loading info screen

And I did just try to print the response before decoding it.

Doh… It looks like that API is functional. Here’s the information for the Roblox account.

What is the Response?

Bruh what does that even mean? It is functional obviously. But something is wrong with the getting thing.

I think I see your issue. In your function code,

local function getPlayerBio(id)
		local URLToGetBio = "https://users.rprxy.xyz/v1/users/"..id
		
		local Response = HttpService:GetAsync(URLToGetBio)
		local Data = HttpService:JSONDecode(Response)
		
		local bio = Data.description
	end

You’re not returning bio, so the script is giving you nil.

3 Likes

Oh wait, I am saying local bio not bio =… agh I am so stupid!

I need to drink coffee, I am so tired…

1 Like

Right I think I fixed it now. Yep I have

Thank you sir :slight_smile:

Also what do u mean by not returning?

Go take a quick power nap, it’ll always be there for you when you get back. :smiley:

Btw, you’ll need to add return bio to the code to make it return the bio, in your example.

Nope, I am storing it as a variable, the start of the code says

local bio

and the code in the function (now) says

bio = Data.description
1 Like

Oh, I see. That works too. :+1:

1 Like

I am also going to use that isBanned thing too just so people don’t get stuck on the loading and waiting for the full 8 seconds

2 Likes