How to get the headshot image of a player?

How do I get an image like this:

image

I wanna use this for a player ID Card?

3 Likes

This might help you

8 Likes

Would any of these work?

6 Likes

Hey your link for some reason dont work so i got code from documentation of roblox so(only for thumbnail of player avatar headshot):

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local PLACEHOLDER_IMAGE = "rbxassetid://0" -- replace with placeholder image id

-- fetch the thumbnail

local userId = player.UserId

local thumbType = Enum.ThumbnailType.HeadShot

local thumbSize = Enum.ThumbnailSize.Size420x420

local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize) -- content is image and is Ready can have true or false to make code know if image loaded

-- set the ImageLabel's content to the user thumbnail

local imageLabel = script.Parent

imageLabel.Image = (isReady and content) or PLACEHOLDER_IMAGE

-- not needed but if imagelabel is too big image will be pixelated very badly: imageLabel.Size = UDim2.new(0, 420, 0, 420)
3 Likes