Hello! For clarity, I’m not trying to make the part face the opposite of its lookvector. I’m trying to make it such that if a part is facing x degrees upwards, I can change it to face x degrees downwards. How would I do this?
(Refer to the below picture if ur confused sorry it’s a bit difficult to explain)
local FacingPart,TargetAnglePart,OppositeAnglePart = workspace.p1,workspace.p2,workspace.p3
local relativeRotation = FacingPart.CFrame:ToObjectSpace(TargetAnglePart.CFrame)
--flipping the CFrame (including rotation)
relativeRotation = relativeRotation:Inverse()
--removing the inverted Position from the CFrame
relativeRotation -= relativeRotation.Position
OppositeAnglePart.CFrame = FacingPart.CFrame * relativeRotation
local Part1 = workspace:WaitForChild("Part1")
local Part2 = workspace:WaitForChild("Part2")
Part1:GetPropertyChangedSignal("CFrame"):Connect(function()
local RotationX = if Part1.Orientation.X > 0 then math.abs(Part1.Orientation.X)*-1 else math.abs(Part1.Orientation.X)
local RotationY = if Part1.Orientation.Y > 0 then math.abs(Part1.Orientation.Y)*-1 else math.abs(Part1.Orientation.Y)
local RotationZ = if Part1.Orientation.Z > 0 then math.abs(Part1.Orientation.Z)*-1 else math.abs(Part1.Orientation.Z)
Part2.CFrame = CFrame.new(Part2.Position) * CFrame.fromOrientation(math.rad(RotationX), math.rad(RotationY), math.rad(RotationZ))
end)