Flipping the ViewPortFrame Horizontally or either changing my code to flip the objects

I have a mirror but its not how you would expect it to be, its actually flipped from a normal mirror. This is an example:
image
Its a ViewPortFrame that has a code:

local vpf = script.Parent:WaitForChild("ViewportFrame")

local mirror = vpf.Parent.Adornee


game:GetService("RunService").Heartbeat:Connect(function()
	
	vpf:ClearAllChildren()
	
	local currentCamera = Instance.new("Camera")
	currentCamera.Parent = vpf
	vpf.CurrentCamera = currentCamera
	
	
	for i, child in pairs(workspace:GetChildren()) do
		
		if not child:IsA("Terrain") and not child:IsA("Camera") and child ~= mirror then
			child.Archivable = true
			
			local clone = child:Clone()
			clone.Parent = vpf
			
			if clone:IsA("BasePart") then
				local distanceFromMirror = (clone.Position - mirror.Position).Magnitude
				clone.Position *= Vector3.new(1, 1, 1)
				clone.Orientation *= Vector3.new(1, -1, 1)
			end
			
			for x, desc in pairs(clone:GetDescendants()) do
				if desc:IsA("BasePart") then
					local distanceFromMirror = (desc.Position - mirror.Position).Magnitude
					desc.Position *= Vector3.new(1, 1, 1)
					desc.Orientation *= Vector3.new(1, -1, 1)
					
				elseif desc:IsA("Humanoid") then
					desc.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
				end
			end
		end
	end
	
	currentCamera.CFrame = mirror.CFrame - (10 * mirror.CFrame.LookVector)
end)

You can also help me change the coding since i think its possible to flip the objects position but I don’t know how.
I’ve already tried negative size values for ViewPortFrame, does NOT flip at all.

2 Likes

o interesante lo usare para un juego

xd :grinning:

Unfortunately, it isn’t really possible to do this without mirroring all the parts.

How would I mirror the parts within the code? thanks for help as well

I’m not sure. You’d need to invert the CFrame’s axis on one end relative to the mirror.

I tried to think of something that does that, but its so hard