get avatar roblox code example

Example: display players image roblox

local Players = game:GetService("Players")
local player = Players.LocalPlayer
 
-- Get the player image
local userId = player.UserId

--ThumbnailTypes:
--"HeadShot": Just the head and face
--"AvatarBust": Upper chest and head
--"AvatarThumbnail": The hole avatar

local thumbType = Enum.ThumbnailType.HeadShot --ThumbnailType

local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
 
-- Insert the player image to an imageLabel
local imageLabel = script.Parent
imageLabel.Image = content
imageLabel.Size = UDim2.new(0, 420, 0, 420)

Tags:

Misc Example