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