Hi guys! I am making a mirror, but I think it’s almost done and I just need a bit of help. The reflecting model on the other side is not animated. Here’s the video:
robloxapp-20201115-0241491.wmv (1.5 MB)
and, here’s the code:
local Mirror = workspace:WaitForChild("Mirror")
local RunService = game:GetService("RunService");
local function Render_Step()
for i, v in next, game.Players:GetPlayers() do
if (v) ~= nil then
if (v.Character) ~= nil then
for a, b in next, v.Character:GetDescendants() do
if (b) ~= nil then
if b:IsA("BasePart") or b:IsA("UnionOperation") or b:IsA("MeshPart") then
local objectSpace = Mirror.CFrame:Inverse() * (v.Character:GetPrimaryPartCFrame());
local worldSpace = Mirror.CFrame:ToWorldSpace(CFrame.new(objectSpace.X, objectSpace.Y, -objectSpace.Z));
v.Character.Archivable = true;
local newCharacter;
if not workspace:FindFirstChild("Dummy") then
newCharacter = v.Character:Clone()
newCharacter.Name = "Dummy"
newCharacter.Parent = workspace;
end
local new = workspace:FindFirstChild("Dummy")
if new then
new:SetPrimaryPartCFrame(worldSpace * CFrame.Angles(0, math.rad(-180), 0))
end
end
end
end
end
end;
end;
end;
RunService.RenderStepped:Connect(Render_Step);
Help is appreciated! Thank you.