Part doesn't rotate on full axis

I’m trying to make the the current part follows the target rotation but it rotates in a very wrong and reversing way. When I tried to do full circle motion, it acts really weird. How do I fix this?

And here is the code I wrote

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Spring = require(ReplicatedStorage.Spring)
local RunService = game:GetService("RunService")
local TargetPart = workspace.TargetPart
local CurrentPart = workspace.CurrentPart
local SpringPos = Spring.new(Vector3.new())
local SpringRot = Spring.new(Vector3.new())
local Offset = CFrame.new(0,0,5)

local function getPositionAndAnglesFromCFrame(cf)
	return cf.Position, Vector3.new(cf:ToOrientation())
end
RunService.Stepped:Connect(function()
	
	local TargetPart_position, TargetPart_angles = getPositionAndAnglesFromCFrame(TargetPart.CFrame)
	
	-- Added spring for a target position
	
	SpringPos.Speed = 10
	SpringPos.Damper = 10
	
	-- Added spring for a target rotation
	
	SpringRot.Speed = 10
	SpringRot.Damper = 10
	
	SpringPos.Target = TargetPart_position
	SpringRot.Target = TargetPart_angles
	CurrentPart.CFrame = CFrame.new(SpringPos.Position) * CFrame.Angles((SpringRot.Position.X) , (SpringRot.Position.Y) , (SpringRot.Position.Z)) * Offset
end)

It would be helpful if you would tell me where the problems are.

Probably because of the order you multiply the CFrames, try this:

CurrentPart.CFrame = (CFrame.new(SpringPos.Position) * Offset) * CFrame.Angles((SpringRot.Position.X) , (SpringRot.Position.Y) , (SpringRot.Position.Z))

Btw, you don’t need to set the Speed and Damper every frame. You can just set it outside the connection once.

It still doesn’t work. It only rotate the current part.

It doesn’t behave what I wanted. Also when you rotated over 180 degrees, it will reverse back to itself. I have no idea how to fix it.

Can anyone help me with these issues please? Anyone?

I cant help you fix it to make it simple in 2d terms when a 2d object rotates when it goes past 180 it goes directly to negative causing the spring script your using to think the best way to get the rotation is to make it go all around so if you used it without a spring script it would work correctly because it doesnt have any costraints change the way the position would work