Hi,

I’m working on wall building system. But there is a problem with tweening, when the rotation of the wall is -90 then with next move it’ll change to +90 that means the wall’ll rotate 180 degrees instead of rotating only a few degrees. I tried using radians and tweening using CFrame, but it didn’t work.

video:

robloxapp-20220401-1546025.wmv (732.1 KB)

my script:

```
local RecalculatedPos1 = module:CalculateModelPosition(Point1)
local RecalculatedPos2 = module:CalculateModelPosition(Point2)
local MiddlePositionX = (RecalculatedPos1.X+RecalculatedPos2.X)/2
local MiddlePositionZ = (RecalculatedPos1.Z+RecalculatedPos2.Z)/2
local MiddlePositionY = RecalculatedPos1.Y+((OtherData["Height"]*module.ItemInteracting.CurrentYGridSize)/2)
local TriangleSideA = RecalculatedPos2.X - RecalculatedPos1.X
local TriangleSideB = RecalculatedPos1.Z - RecalculatedPos2.Z
local TriangleSideC = math.sqrt((TriangleSideA * TriangleSideA) + (TriangleSideB * TriangleSideB)) --Calculate triangle side C by Pythagorean theorem, SideC = MiddlePart size between Point1 and Point2
local TriangleAngle = math.deg(math.atan(TriangleSideB/TriangleSideA)) --Calculate isosceles triange angle in degrees, Triange angle Aplha = Triangle angle Beta, Triangle angle Delta is counting by size of side A and side B
if module.Settings.MaxPlaneVerticalScalingLenght < TriangleSideC then
TriangleSideC = module.Settings.MaxPlaneVerticalScalingLenght
end
local MiddleSize = Vector3.new(TriangleSideC,OtherData["Height"]*module.ItemInteracting.CurrentYGridSize,0.5)
local StartPosition = RecalculatedPos1
local EndPosition = Vector3.new(RecalculatedPos2.X,RecalculatedPos1.Y,RecalculatedPos2.Z)
local MiddleRotation = Vector3.new(0,TriangleAngle,0)
local MiddlePosition = Vector3.new(MiddlePositionX,MiddlePositionY,MiddlePositionZ)
print(MiddleRotation.Y)
if (ScalingPart.Position - MiddlePosition).Magnitude > module.Settings.MaxPlaneVerticalScalingLenght then --Set tween goal before tween started if middle part position is too far from goal position
ScalingPart.Position = MiddlePosition
ScalingPart.Size = MiddleSize
return
end
if TweenInstance2 then
TweenInstance2:Cancel()
end
local TweenGoal = {
Position = MiddlePosition,
Size = MiddleSize,
Orientation = MiddleRotation
}
TweenInstance2 = TweenService:Create(ScalingPart, module.Settings.TweenSettings, TweenGoal)
TweenInstance2:Play()
```

Thank you for any help!