How do i put the players ingame avatar inside a poster surfacegui?

so im making a bounty system like arcane oddysey and in arcane oddysey the players ingame avatar is on the poster, how would i be able to do this? since im im trying to do this on a surfacegui but it doesnt work for me for some reason, anybody know why? heres my layout:

image

here is how i want it:
image

try this

local players = game:GetService("Players")
local player = players.LocalPlayer

local headshot = Enum.ThumbnailType.HeadShot
local size = Enum.ThumbnailSize.Size420x420

local image = players:GetUserThumbnailAsync(player.UserId, headshot, size)

Poster.Texture = image

i need the ingame avatar, not the roblox avatar

If it’s global…

You can probably use DataStore to save an array to a player, where you have an index of all the total accessories. If they are wanted, you can obtain the said array and load it onto a dummy.

local accessoriesArray = {1, --//Hat
5, --//Face
7, --//Hair
1, --//Shirt
0, --//Cape, for example, 0 meaning no cape
}

thats not the problem ik how to do that, i need to know how to make the dummy visible on the poster’s viewportframe

1 Like

I made a function that works for me, you might need to mess around with the camera CFrame but should work.

local players = game:GetService("Players")

local function getCharacterThumbnail(character : Model) : (WorldModel, Camera, Model)
	local humanoid = character:FindFirstChild("Humanoid") :: Humanoid
	assert(humanoid, "No humanoid found")
	
	local description = humanoid:GetAppliedDescription() :: HumanoidDescription
	assert(description, "Humanoid has no applied description")
	
	-- // I create a new model instead of cloning to avoid cloning tools
	-- // and other things that might be placed inside the players character
	
	local container = Instance.new("WorldModel")
	-- // The npc is automatically named "Player" when using CreateHumanoidModelFromDescription() 
	local npc = players:CreateHumanoidModelFromDescription(description, humanoid.RigType)
	local target = npc.Head :: BasePart
	npc:PivotTo(CFrame.new())
	npc.Parent = container
	
	local thumbnailCamera = Instance.new("Camera", container)
	local offset = 3.5
	thumbnailCamera.Name = "ThumbnailCamera"
	thumbnailCamera.CFrame = target.CFrame * CFrame.Angles(0, math.rad(180), 0) * CFrame.new(0, 0, offset)
	
	return container, thumbnailCamera, npc
end

local vpf = Instance.new("ViewportFrame")
local container, camera = getCharacterThumbnail(workspace.Rig)
container.Parent = vpf
vpf.CurrentCamera = camera

This is what it would look like

1 Like

thanks alot appreciate it man!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.