ModuleScript does not copy models

Hello! I’m making a Chromatic Aberration effect using viewport frames. It works as intended but it will not copy models. How do I fix that?

code:

	for _,inst in pairs(workspace:GetChildren()) do
		if inst:IsA("Terrain") then
			return false
		end
		if inst:IsA("BasePart") then
			local tempParts = inst:Clone()
			tempParts.Anchored = true
			tempParts.CanCollide = false
			tempParts.CanTouch = false
			tempParts.CastShadow = false
			tempParts.Massless = true
			tempParts.Reflectance = 0
			tempParts.Material = Enum.Material.Neon
			
			local redPart = tempParts:Clone()
			redPart.Parent = redViewport.World
			local bluePart = tempParts:Clone()
			bluePart.Parent = blueViewport.World
			local greenPart = tempParts:Clone()
			greenPart.Parent = greenViewport.World
			
			tempParts:Destroy()
			
			local function CopyBasePartCFrame()
				redPart.CFrame = inst.CFrame
				bluePart.CFrame = inst.CFrame
				greenPart.CFrame = inst.CFrame
			end
			run.RenderStepped:Connect(CopyBasePartCFrame)
			end
	end
	for _,group in pairs(workspace:GetChildren()) do
		if group:IsA("Model") then
	       local model = group
	       model.Archivable = true
	       local redModel = model:Clone()
	       redModel.Parent = redViewport.World
	       local greenModel = model:Clone()
	       greenModel.Parent = greenViewport.World
	       local blueModel = model:Clone()
	       blueModel.Parent = blueViewport.World
        end
	end
1 Like

Solved it. i had to change return to continue. allthough i still have one more issue

1 Like

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