How can I get a player's Profile Status

So, I was wondering how I can get the status of my profile and make a textlabel with the status on it.

I want to extract the “DevForum Member - Profile - Aiden_12114 - DevForum | Roblox” from this and make the TextLabel’s text that. Can I do this and if so, how?

2 Likes

You would need to make a request to https://users.roblox.com/v1/users/{id}/status where id is the ID of the player.

Since Roblox doesn’t allow developers to send requests to their own endpoints using HttpService you will need a proxy. For this one I would use https://rprxy.xyz. So you would request to https://users.rprxy.xyz/v1/users/{id}/status

local USER_ID = 1 -- Roblox
local URL = string.format("https://users.rprxy.xyz/v1/users/%d/status", USER_ID)

local HttpService = game:GetService("HttpService")

local response = HttpService:RequestAsync({
    Url = URL,
    Method = "GET" -- GETting the data + this endpoint only accepts
                   -- this request type
})

if response.Success then
    local status = HttpService:JSONDecode(response.Body).status
    -- response.Body would be a JSON-encoded table,
    -- so it would look like {"status": "[the status]"}, so it needs to be
    -- decoded into a Lua table
end
3 Likes

What does string.format do and why shouldn’t I just use local URL = "https://users.rprxy.xyz/v1/users/"..USER_ID.."/status"?

It is cleaner to do, with concatenation it can get messy

Ah, ok. So the %d represents the value on the second parameter?

No

%d is a format specifier for a digit. The second argument is put wherever the %d is. If it is not a digit then Lua(u) will scream at you at runtime

Lol, alright. What happens if I did not want it to be a digit?

Then you can use %s which means string. There are a lot of cool specifiers you can “make”, for instance %02d pads a 0 to a number if it isn’t 2 digits long already, e.g string.format("%02d", 5) == "05" but string.format("%02d", 12) == "12" but this is beyond the scope of your topic

Awesome! Thank you so much for the help and teaching me String Formatting. Cheers!