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.
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.
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.