Tween getting slow when approaching the part

I have 2 parts, one follows the mouse, and another follows the part that follows the mouse:

I will call the blue part “BluePart” and the green part “GreenPart”.
What’s happening is that when BluePart gets close to GreenPart, it gets slow, and when it moves away, it gets fast:

Here is the code:

-->> Modules <<--

local _S = require(workspace.Services)

-->> Variables <<--

local sp = script.Parent
local target = workspace['TargetPart_SacerRaym_BR']

local tweenInfo = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)

-->> Functions <<--

_S.RunService.Heartbeat:Connect(function()
	local tween = _S.TweenService:Create(sp, tweenInfo, {Position = target.Position})
	tween:Play()
end)

That’s because you have a set TweenTime for 2, instead of the magnitude divided to your choice.

Set the tween time to always be the magnitude between the parts and then if you want, divided by an amount.

tweenInfo.new((bluePart.Position-greenPart.Position).magnitude
[EasingStyle,EasingDirection,etc.])

And have this update inside the Heartbeat function.

1 Like