Layered Clothing not showing up in ViewportFrame.WorldModel

Hello,

I tried making a working mirror in Roblox Studio, and it went really smooth. I made the mirror work with every Instance other than Shirt Graphic and Layered Clothing Instances.

I understand why Shirt Graphic Instances don’t work in ViewportFrames, but I couldn’t figure out why Layered Clothing doesn’t appear in ViewPortFrames.

Do viewportframes not render LayeredClothing or is there something wrong with my code?

Local Script:


local Camera = game.Workspace.Camera:Clone()
script.Parent.CurrentCamera = Camera

repeat Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable

function SearchModel(Model)
	
	local model = Instance.new("Model")
	model.Parent = script.Parent.WorldModel
	
	for i, Object in pairs(Model:GetChildren()) do
		
		if Object:IsA("Part") or Object:IsA("MeshPart") or Object:IsA("Humanoid") or Object:IsA("Shirt") or Object:IsA("Pants") or Object:IsA("Accessory") or Object:IsA("Body Colors") or Object:IsA("Shirt Graphic") then

			local ObjectClone = Object:Clone()
			ObjectClone.Parent = model		
			
			if not ObjectClone:IsA("Humanoid") and not ObjectClone:IsA("Pants") and not ObjectClone:IsA("Shirt") and not ObjectClone:IsA("Accessory") and not ObjectClone:IsA("Body Colors") and not Object:IsA("Shirt Graphic") then
				ObjectClone.Anchored = true
			elseif ObjectClone:IsA("Accessory") then
				ObjectClone.Handle.Anchored = true
			end
		elseif Object:IsA("Model") then
			SearchModel(Object)
		end
	end 
end

while task.wait(.01) do
	Camera.CFrame = game.Workspace.Mirror.CFrame

	for i, object in pairs(script.Parent.WorldModel:GetChildren()) do
		if object:IsA("Part") or object:IsA("MeshPart") or object:IsA("Model") then
			object:Destroy()
		end
	end

	-- Get all objects
	for i, object in pairs(game.Workspace:GetChildren()) do
		if object.Name ~= "Mirror" then
			if object:IsA("Part") or object:IsA("MeshPart") then
				object:Clone().Parent = script.Parent.WorldModel
			elseif object:IsA("Model") then
				SearchModel(object)
			
			end
		end
	end
end
1 Like