How could i change this lerp into a tween

how can i make this lerp a tween

RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 3), math.rad(-Value1 * 3), 0), 0.2)
1 Like

Why do you need to make it into a tween?

it snaps sometimes and I want to see if a tween would fix it

this makes a tween and destroys it when its done

local TweenService = game:GetService("TweenService")

local tween = TweenService:Create(
	RootJoint, 
	TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In), 
	{C0 = RootJointC0 * CFrame.Angles(math.rad(Value2 * 3), math.rad(-Value1 * 3), 0)}
) 
tween:Play() 

tween.Completed:Once(function() 
	tween:Destroy() 
end)
1 Like

thank you this works

am not familiar with tweens, should i be destroying the tweens after? Do they always leave something behind?

1 Like

it’s not necessary since they get garbage collected when they’re not used but I just like to do it

a tip for if you’re using them in loops is if the properties stay the same (for example you’re tweening to a part which will never change position) then it doesn’t have to be created every time

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.