Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My User bust Thumbnail isn't working, What am I doing wrong?

Hi. So I'm working on my GUI and part of it shows the user's roblox.com thumbnail and I want it to be shown using the Bust method.

I don't understand why it isn't working but it will work with the Regular method. Here is my code:

script.Parent.Image = "http://www.roblox.com/bust-thumbnail/json?userId=" .. game.Players.LocalPlayer.UserId .. "&height=180&width=180"

It's in a local script and it works if I put the code for the Regular method in there. Any Idea as to what's going on and how I can fix this? Thanks. Chief.

4 comments

0

Problem is that it returns JSON formated data, not plain url to the image. You could get it using HttpGet and decode with the JSON functions, but roblox doesn't allow HttpGet requests to roblox website.

0

So how do I do it??

0

Yeah there's also a small problem. We tried this before and apparently Roblox simply won't allow stuff from the t cdn servers.

0

So is this impossible?

2 answers

From what I can see on the wiki, it returns a JSON dictionary contains a URL and some other value. Use

local dict = game:GetService("HTTPService"):JSONDecode("bust url")

on the bust URL, then call for the argument Url as seen below:

script.Parent.Image = dict["Url"]

Note: I'm on an iPad right now so I couldn't test this, however I believe it should work as the url returned in the dictionary links to rbxcdn.

3 comments

0

That won't work, because you first have to make a HTTP request and then decode the response. Sadly, you can't make HTTP requests to roblox website.

0

That's true. You'd have to create your own offsite api, I suppose.

0

Huh, How?? So it's impossible? I've seen games using this and the headshot thumbnails.

Hello! I know its been two years and you may have figured this out already, but you are using the json format as said before! so ill help you fix this. There is the basic "get image from url" which basic just loads the image, and if it doesnt find one then ill be a big white box with something in the middle, and there is the complex way, which will check if the image is loaded, and if not, itll set it to some other image.

heres the basic way:

script.Parent.Image= "https://www.roblox.com/bust-thumbnail/image?userId=".. game.Players.LocalPlayer.UserId .."&width=420&height=420&format=png"

This is ok, if you dont want to have a replacment image for the image if the user's icon doesnt load(normally happens when trying to load many)

heres the more complex way:

local thumbnail, loaded= game.Players:GetUserThumbnailAsync(game.Players.LocalPlayer.UserId,"AvatarBust","Size420x420")

if loaded then
	script.Parent.Image=thumbnail
else
	script.Parent.Image= "http://www.roblox.com/asset/?id=49573081"
end

This will use a function in the "Players" service called GetUserThumbnailAsync to see if the image loads, if so, then use it, otherwise load an alternate photo, in this case i use "http://www.roblox.com/asset/?id=49573081". Heres more on GetUserThumbnailAsync

This discussion is preserved as it was. New answers, comments, and votes are closed.