Hey there, I am making a mirror reflection system, but the character being rendered is not animated. I need help with this ASAP. Here's my code:
local Mirror = game.Workspace:WaitForChild("Mirror")
local RunService = game:GetService("RunService");
local function reflect()
for i, v in next, game.Players:GetPlayers() do
if (v) ~= nil then
if (v.Character) ~= nil then
v.Character.Archivable = true
if not game.Workspace:FindFirstChild("Dummy") then
local character = v.Character:Clone()
character.Name = "Dummy"
character.Parent = game.Workspace
end
if workspace:FindFirstChild("Dummy") then
for index, val in pairs(workspace.Dummy:GetDescendants()) do
if val:IsA("BasePart") or val:IsA("UnionOperation") or val:IsA("MeshPart") then
local plrchar = v.Character:FindFirstChild(val.Name, true)
local objectedSpace = Mirror.CFrame:Inverse() * plrchar.CFrame
local yaw, pitch, roll = objectedSpace:ToEulerAnglesXYZ()
local worldSpace = Mirror.CFrame:ToWorldSpace(CFrame.new(objectedSpace.X,objectedSpace.Y, -objectedSpace.Z)) * CFrame.Angles(yaw, -pitch, roll);
val.CFrame = worldSpace * CFrame.Angles(0, -math.pi+math.pi, 0)
end
end
end
end
end
end;
end;
RunService.RenderStepped:Connect(reflect);
Note: It's a local script, and I just wanna understand the logic of this.
