local v=script.Parent local X=v.Configuration local C=X.Username.Value local function p()for v,X in pairs(v:GetChildren())do if X:IsA("\067\104\097\114\097\099\116\101\114\077\101\115\104")or X:IsA("\083\104\105\114\116")or X:IsA("\080\097\110\116\115")or X:IsA("\065\099\099\101\115\115\111\114\121")or X:IsA("\083\104\105\114\116\071\114\097\112\104\105\099")then X:Destroy()end end if v.Head:findFirstChild("\077\101\115\104")then v.Head.Mesh:Destroy()end end local function h()local X=game.Players:GetCharacterAppearanceAsync(game.Players:GetUserIdFromNameAsync(C))for X,C in pairs(X:GetChildren())do if C:IsA("\083\112\101\099\105\097\108\077\101\115\104")or C:IsA("\066\108\111\099\107\077\101\115\104")or C:IsA("\067\121\108\105\110\100\101\114\077\101\115\104")then C.Parent=v.Head elseif C:IsA("\068\101\099\097\108")then v.Head.face.Texture=C.Texture elseif C:IsA("\066\111\100\121\067\111\108\111\114\115")or C:IsA("\067\104\097\114\097\099\116\101\114\077\101\115\104")or C:IsA("\083\104\105\114\116")or C:IsA("\080\097\110\116\115")or C:IsA("\083\104\105\114\116\071\114\097\112\104\105\099")then if v:findFirstChild("\066\111\100\121 \067\111\108\111\114\115")then v["\066\111\100\121 \067\111\108\111\114\115"]:Destroy()end C.Parent=v elseif C:IsA("\065\099\099\101\115\115\111\114\121")then C.Parent=v C.Handle.CFrame=(v.Head.CFrame*CFrame.new(0,v.Head.Size.Y/2,0))*C.AttachmentPoint:inverse()else print("\079\098\106\101\099\116\058 "..(C.Name..(" \105\115 \110\111\116 \114\101\099\111\103\110\105\115\101\100\044 \116\121\112\101\058 "..C.ClassName)))end end if not v.Head:FindFirstChild("\077\101\115\104")then local X=Instance.new("\083\112\101\099\105\097\108\077\101\115\104",v.Head)X.MeshType=Enum.MeshType.Head X.Scale=Vector3.new(1.25,1.25,1.25)end end wait(2)h()


local Model = script.Parent
local Config = Model.Configuration
local Username = Config.Username.Value

local function resetModel()
	for i,v in pairs(Model:GetChildren()) do
		if v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('Accessory') or v:IsA('ShirtGraphic') then
			v:Destroy()
		end
	end
	if Model.Head:findFirstChild('Mesh') then
		Model.Head.Mesh:Destroy()
	end
end

local function updateModel()
	local AppModel = game.Players:GetCharacterAppearanceAsync(game.Players:GetUserIdFromNameAsync(Username))
	for i,v in pairs(AppModel:GetChildren()) do
		if v:IsA('SpecialMesh') or v:IsA('BlockMesh') or v:IsA('CylinderMesh') then
			v.Parent = Model.Head
		elseif v:IsA('Decal') then
			Model.Head.face.Texture = v.Texture
		elseif v:IsA('BodyColors') or v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('ShirtGraphic') then
			if Model:findFirstChild('Body Colors') then
				Model['Body Colors']:Destroy()
			end
			v.Parent = Model
		elseif v:IsA('Accessory') then
			v.Parent = Model
			v.Handle.CFrame = Model.Head.CFrame * CFrame.new(0, Model.Head.Size.Y / 2, 0) * v.AttachmentPoint:inverse()
		else
			print('Object: '..v.Name..' is not recognised, type: '..v.ClassName)
		end
	end
	if not Model.Head:FindFirstChild('Mesh') then
		local m = Instance.new('SpecialMesh', Model.Head)
		m.MeshType = Enum.MeshType.Head
		m.Scale = Vector3.new(1.25, 1.25, 1.25)
	end
end
wait(2)
updateModel()
