Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Getting the head shot of the avatar?

Asked by
RoyMer 301 Moderation Voter
9 years ago

How can I get the head shot of the avatar to use it in imagelabels etc?

http://prntscr.com/9xpu7u

^That pic is what I'm referring to (it's on everyone's profile)

1 answer

Log in to vote
3
Answered by 9 years ago

Not sure if there is a specific way to get a players head, although I know how to get their whole body, which you can then readjust so it only shows the player's head.

Getting the Image

To get any player's avatar we will be using the link below. At default if you are logged in to roblox on the same browser it will auto assign it to your avatar. You can also add anyone's username on the end, even mine! Just add on the end where it says username= the players username.

"http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=200&Format=Png&username="

Specific Players

For this, you will need to use your own variables.

local Player = script.Parent.Parent.Parent -- Just using this as an example.
local ImageLabel = script.Parent

function YourFunction()
ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=200&Format=Png&username=" ..Player.Name -- This bit is important
end

CallFunction(YourFunction)

By adding the ..Player.Name onto the end of the link, it will fetch us the correct users image, make sure you set all of the variables correctly.

I hope I helped :)

Ad

Answer this question