While there is a way to make a part travel along a curve using tweens, I wouldn't really recommend using this method since you're very limited on how you can configure the curve.
To make a part move along a curve, we have to first create a tween that will make it move on the X/Z axis and another separate tween to make it move in a curve. Since we can't have multiple tweens edit a single property at the same time, we'll have to create a Mesh object and have the other tween affect the offset property. This way the tween won't overwrite each other.
local TweenService = game:GetService('TweenService')
local Folder = script.Parent
local Part = Folder.Point
local p1 = Folder.Start
local p2 = Folder.End
local curveHeight = 20
local t = 1
Part.Position = p1.Position
local xzAxis = TweenService:Create(
Part,
TweenInfo.new(t,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,true),
{Position=p2.Position}
)
local yAxis = TweenService:Create(
Part.Mesh,
TweenInfo.new(t/2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,1,true),
{Offset=Vector3.new(0,curveHeight,0)}
)
while true do
xzAxis:Play()
yAxis:Play()
wait(t + 1)
end
3 comments
This was helpful. However, I'm not talking about lag. I'm taking about using a leap or tweeting function, I just don't know how to go about that.
Lol autocorrect, a lerp or tweening function
aren't you already using lerp by interpolationing through each node?