Attempting to mirror a blocky avatar across a specific axis to give the illusion of a mirror for my puzzle game, unfortunately the original solution I made had several bugs. The rotation would break constantly and attempting to teleport the player would result in the reflection breaking entirely
I tried using CFrames and ended with the code below but it perfectly imitates the player movement, overlapping on to the player, instead of mirroring across an axis.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
while true do wait()
--Player parts:
local head = chr:WaitForChild("Head")
local root = chr:WaitForChild("Torso")
local LArm = chr:WaitForChild("Left Arm")
local RArm = chr:WaitForChild("Right Arm")
local RLeg = chr:WaitForChild("Right Leg")
local Lleg = chr:WaitForChild("Left Leg")
local function MoveLimb(Limb, RLimb)
RLimb.CFrame = CFrame.new(Limb.Position, Limb.Position + Limb.CFrame.lookVector)
end
MoveLimb(head, script.Parent:WaitForChild("Head"))
MoveLimb(root, script.Parent:WaitForChild("Torso"))
MoveLimb(LArm, script.Parent:WaitForChild("Left Arm"))
MoveLimb(RArm, script.Parent:WaitForChild("Right Arm"))
MoveLimb(Lleg, script.Parent:WaitForChild("Left Leg"))
MoveLimb(RLeg, script.Parent:WaitForChild("Right Leg"))
end
end)
Iām still new to CFrames so any help would be greatly appreciated.