Axolotleless

Mirror

Jan 31st, 2025
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.61 KB | None | 0 0
  1. local Mirror = game.Workspace:WaitForChild("Mirror")
  2.  
  3. local RunService = game:GetService("RunService");
  4.  
  5. local Mirror = game.Workspace:WaitForChild("Mirror")
  6.  
  7. local RunService = game:GetService("RunService");
  8.  
  9. local function reflect()
  10.  
  11.     for i, v in next, game.Players:GetPlayers() do
  12.  
  13.         if (v) ~= nil then
  14.  
  15.             if (v.Character) ~= nil then
  16.  
  17.                 for a, b in next, v.Character:GetDescendants() do
  18.                     if (b) ~= nil then
  19.                         if b:IsA("BasePart") or b:IsA("UnionOperation") or b:IsA("MeshPart") or b:IsA("Motor6D") then
  20.  
  21.                             if not b:IsA("Motor6D") then
  22.                                 local objectSpace = Mirror.CFrame:Inverse() * (v.Character:GetPrimaryPartCFrame());
  23.  
  24.  
  25.                                 local yaw, pitch, roll = objectSpace:ToEulerAnglesXYZ()
  26.  
  27.                                 local worldSpace = Mirror.CFrame:ToWorldSpace(CFrame.new(objectSpace.X, objectSpace.Y, -objectSpace.Z) * CFrame.Angles(yaw, -pitch, roll));
  28.                                 v.Character.Archivable = true;
  29.  
  30.                                 local newCharacter;
  31.  
  32.                                 if not workspace:FindFirstChild("Dummy") then
  33.  
  34.                                     newCharacter = v.Character:Clone()
  35.  
  36.                                     newCharacter.Name = "Dummy"
  37.  
  38.                                     newCharacter.Parent = workspace;
  39.  
  40.                                 end
  41.  
  42.                                 local new = workspace:FindFirstChild("Dummy")
  43.  
  44.                                 if new then
  45.  
  46.                                     local set = worldSpace * CFrame.Angles(0, -math.pi, 0)
  47.  
  48.                                     new:SetPrimaryPartCFrame(set)
  49.                                 end
  50.                             else
  51.                                 local new = workspace:FindFirstChild("Dummy")
  52.                                 if new then
  53.                                     local motor = new:FindFirstChild(b.Name, true)
  54.                                     if motor and motor.Name == b.Name then
  55.                                         motor.Part0 = new:FindFirstChild(b.Part0.Name)
  56.                                         motor.Part1 = new:FindFirstChild(b.Part1.Name)
  57.                                         motor.CurrentAngle = b.CurrentAngle
  58.                                     end
  59.                                 end
  60.  
  61.                             end
  62.                         end
  63.                     end
  64.                 end
  65.             end
  66.         end;
  67.     end;
  68. end;
  69.  
  70.  
  71. RunService.RenderStepped:Connect(reflect);
Advertisement
Add Comment
Please, Sign In to add comment