TweenService smooth acceleration

Hello, I wrote a script that lets a MovePart drive over a distance with Tweenservice. But unfortunately it is the case that if the function is always executed when the MovePart moves to the next part, it gets faster from the angle until then everything is fine, but the problem is: it always does it hesitantly you can see from the outside when it accelerates more and when it does It’s getting slower but step by step how can I make it go smoothly to the new MovementSpeed during the animation instead of directly. So that it accelerates smoothly to the new speed during the tween animation.

If you need more script lines let me know but here’s the important part it’s all in a function that fires again when the tween is finished.

local targetCFrame = spineData.part.CFrame

		local distance = (targetCFrame.Position - movingPart.Position).Magnitude
		local tweenTime = distance / math.abs(movementSpeed)

		local tweenInfo =, Enum.EasingStyle.Linear)
		local tween = tweenService:Create(movingPart, tweenInfo, {CFrame = targetCFrame})


1 Like

dont use tween service but do your calculations within this function and set the part’s position right away

game:GetService("RunService").Stepped:Connect(function(t, dt) --- runs every frame update
 --- dt is delta time. this is how long it took since the last run to run again. do things like speed * dt do 
 --- make everything frame indepentent.
1 Like

Can you give me a more detailed explanation? I’m just a little confused.

well basicly instead of calling tweenservice to set the position every x amount of time. you set the position for every frame.

this way you can adjust the speed every frame and there will be no hitches.

game:GetService("RunService").Stepped:Connect(function(t, dt) --- runs every frame update
 local speed = (speedcalculation)
 cart.Position = (your target position)