Hello, I was wondering how I could find a user's profile image and use that image to update an image label in the gui. I imagine I would have to use something like player.userId along with an address to the games main page. How would I get this location of their image?
Ok, so we can either get the player's image by using his username, or using his UserId. In the first chunk here it's getting his profile picture by his username.
I am assuming that this is a LocalScript and it is located inside of the ImageLabel.
local player = game.Players.LocalPlayer function update() script.Parent.Image= "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..player.Name end update()
This chunk here is how I would get my profile picture using my username.
script.Parent.Image="http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=DanzLua"
The first method wouldn't get you the right image in studio because your username is either Player1 or Player.
For this part I am using the player's UserId to get his profile picture.
local player = game.Players.LocalPlayer function update() script.Parent.Image= "https://web.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid="..player.UserId end update()
This chunk here is how I would get my profile picture using my UserId.
script.Parent.Image= "https://web.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid=6755068"
I hoped this helped :)
SCRIPT
ImageLabel.Image = 'http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username='...player.Name --You'll have to replace ImageLabel.
EXPLANATION
This is one of the multiple ways you can get a player's picture. This one uses their username. There is also one where you can use a PlayerID. Personally, I like using a Username more, even though it's the script doing the work, and not me.