Im trying to make a gui where upon joining the text displays the players name and the viewportframe shows the players avatar. I got the name part down, but I just cant get the avatar bust to work.
I started with an avatarthumbnail but since i apply custom clothing to the player it doesnt show up in the thumbnail, so i switched to a viewportframe and i just cant figure it out.
the problem is that its warning that it failed to clone character like I set up

please help, thanks!
and sorry if this is something really simple that i just missed.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local GUI = script.Parent
local HUD = GUI.HUD
local BustLabel = HUD.bust
local NameText = HUD.NameFrame.TextLabel
function SetName()
NameText.Text = player.Name
end
function SetBust()
if not player.Character then
player.CharacterAdded:Wait()
end
print("set bust")
for _, child in ipairs(BustLabel:GetChildren()) do
if child:IsA("Model") then
child:Destroy()
end
end
local success, charClone = pcall(function()
return player.Character:Clone()
end)
if not success or not charClone then
warn("Failed to clone character")
return
end
print("character cloned")
for _, object in ipairs(charClone:GetDescendants()) do
if object:IsA("Script") or object:IsA("LocalScript") then
object:Destroy()
end
end
print("remove scripts")
for _, object in ipairs(charClone:GetDescendants()) do
if object:IsA("BasePart") then
object.Anchored = true
end
end
print("character anchored")
charClone.Parent = BustLabel
local camera = Instance.new("Camera")
camera.Parent = BustLabel
local root = charClone:FindFirstChild("HumanoidRootPart")
local focusPos = root and root.Position + Vector3.new(0, 2, 0) or Vector3.new(0, 2, 0)
camera.CFrame = CFrame.new(focusPos + Vector3.new(0, 0, 5), focusPos)
BustLabel.CurrentCamera = camera
print("done")
end
SetName()
player.CharacterAdded:Connect(SetBust)
