I am trying to add an Avatar Headshot to a discord embed.
The Webhook works fine it’s just the Avatar Headshot.
https://www.roblox.com/headshot-thumbnail/image?userId='.. userId ..'&width=420&height=420&format=png
Is this deprecated or am I just typing something wrong?
Not sure why it is not working but use this instead:
BE ADVISED that this returns an OBJECT.
Please view the exemplar below:
You must send a get request using HttpService and then :FromJSON. Then index into imageUrl to get the Url. This gives you a nice crispy good looking image.
I got an error that says…
HttpService is not allowed to access ROBLOX resources
How do I get around that?
You’ll need to use a proxy, as Roblox deliberately rejects HttpService from accessing resources.
You can use GetUserThumbnailAsync() instead
Players:GetUserThumbnailAsync(userid, thumbnailtype, thumbnailsize)
How do I go about using a proxy?
I’ve never done it before.
Unfortunately this only produces a ROBLOX oriented render. What we are attempting to do here is linkify it for external access, for example in this case, it’s for Discord.
As in from, a discord bot? Or passing info from a roblox server to discord?
A Discord webhook, which is delivered data from the Roblox server.
There are several proxy services like Hyra, but if you’re concerned about privacy, then there are tutorials and open-sourced projects around the internet on creating your own proxy services, so you might want to check those out.
If it’s from a Roblox server then,
GetUserThumbnailAsync() can be used, since it will only return a tuple containing the image url and a boolean to check if its loaded or not.
Hyra is for “Roblox to Discord”.
I need to get the
imageUrl from Roblox, without it throwing me a “HttpService is not allowed to access ROBLOX resources”
I don’t think this will work. I’m going to try it again though.
ROBLOX uses their own little embedding software that takes shortened links like this:
(This is the result of GetUserThumbnailAsync(). This is an encoded ROBLOX link)
and transfers them to this:
There is no current method of going from one to the other. The only way to do this is by sending a GET request to the ROBLOX server itself sadly.
Yes, this does not work.
HTTP 400 (Bad Request)
You need to use roblox api and proxy.
local http = game:GetService("HttpService")
local function getheadshot(userid)
local s, data = pcall(function()
if s and data then
return "https://t3.rbxcdn.com/9fc30fe577bf95e045c9a3d4abaca05d" --example, if it was not possible to get an avatar
print(getheadshot(1)) --> https://tr.rbxcdn.com/ea3425c2b657de9af16c629441e0dcb2/420/420/AvatarHeadshot/Png