If it is working, then I’d there is no reason to make it with tweens. Like this you also have more customizability over the lerp.
If you ever want to change the easing (if you haven’t already), then you can just look up “easing functions” and pick one from there.
Please forgive me if I oversimplify, but I’m not too sure on your scripting knowledge so I’ll just explain as if you’re a begginner.
Lerp is not the same as tween. It basically gets a value between two values, depending on the alpha value (0 to 1.) So for example, If i lerped 0 and 10, and gave the alpha of 0.7, the lerp would return 7. It does not animate parts smoothly as tween does.
Heres a quick example of code that uses lerp to smoothly animate a part.
local targetPart = -- the targets primary part OR whatever part you want to move.
local startCFrame = -- the cframe of your target
local goalCFrame = -- the cframe of your attacker.
local alpha = 0
local lerpDuration = 1
while alpha <= 1 do
local deltaTime = task.wait() -- allows us to see how long it waited.
targetPart.CFrame = startCFrame:Lerp(goalCFrame, alpha)
alpha = alpha + (deltaTime / lerpDuration)
end
targetPart.CFrame = goalCFrame -- As the alpha may not reach 1 fully, we add this to make sure the part reaches the goal.
The benefit of lerp is that you can change the goalCFrame while the loop is active. The benefit of Tween is that it’s easier to use, theres more customizability, and multiple tweens cannot overlap eachother, but you have a lot less control over it while its running.
Tweening has no benefits over lerps other than being somewhat easier to use.
Lerps can very simply be made into smooth ones by throwing the alpha into an easing function, such as this one (got it from Easing Functions Cheat Sheet, scroll down to Math function)
local function EaseOutSine(x: number): number
return math.sin((x * math.pi) / 2)
end
TweenService is basically a lerp wrapper. They both use linear interpolation. The benefit is that it’s there and ready to use without having to code the system yourself. And because it’s a service those easing functions don’t bloat your codebase.