How to make a R6 Auto-Loader Statue?

I just want to know how to make an R6 Statue of myself auto-loads, like this:

image

image

This is a free-model i took while searching around for it, but i would like to know if there is any more prathic way to do so, and ALSO how can i fix the missplaced hats? (Like the scarf?)

Script:

local Loader = {}

function Loader:resetModel(Model)
	for _, Object in next, Model:GetChildren() do
		if Object:IsA('CharacterMesh') or Object:IsA('Shirt') or Object:IsA('Pants') or Object:IsA('Hat') or Object:IsA('ShirtGraphic') then
			Object:Destroy()
		end
	end
	if Model.Head:findFirstChild('Mesh') then
		Model.Head.Mesh:Destroy()
	end
end

function Loader:updateModel(Model, userId)
	
	local AppModel = game.Players:GetCharacterAppearanceAsync(userId)
	Model.Name = game.Players:GetNameFromUserIdAsync(userId)
	
	for _, Object in next, AppModel:GetChildren() do
		
		if Object:IsA('SpecialMesh') or Object:IsA('BlockMesh') or Object:IsA('CylinderMesh') then
			
			Object.Parent = Model.Head
		
		elseif Object:IsA('Decal') then
			
			Model.Head.face.Texture = Object.Texture
		
		elseif Object:IsA('BodyColors') or Object:IsA('CharacterMesh') or Object:IsA('Shirt') or Object:IsA('Pants') or Object:IsA('ShirtGraphic') then
			
			if Model:findFirstChild('Body Colors') then
				
				Model['Body Colors']:Destroy()
				
			end
			
			Object.Parent = Model
			
		elseif Object:IsA('Accessory') then
			
			Object.Parent = Model
			Object.Handle.CFrame = Model.Head.CFrame * CFrame.new(0, Model.Head.Size.Y / 2, 0) * Object.AttachmentPoint:inverse()
			
		elseif Object:IsA('Folder') then
			
			if Object.Name == 'R6' then
				Object:GetChildren()[1].Parent = Model
			end
		
		else
			
			print('Object: '..Object.Name..' is not recognised, type: '..Object.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

return Loader

I suggest using the HumanoidDescription System instead. You can easily fetch the description of a user using Players:GetHumanoidDescriptionFromUserId and apply it to a Humanoid using Humanoid:ApplyDescription. This automatically loads in body colors, body parts, animations, face, accessories and clothing.

2 Likes

Almost the same result as the script above, except for the head not changing mesh and some hats still missplaced

image

Nevermind, just followed Flubberlutsch tip + added the Attachments to the model parts and it worked:

1 Like