I am creating a sludge bomb that’s supposed to attack a boat. However, the player can move their position, which means by the time the bomb hits them, there position is different.
I am using Sleitnicks Bezier module
local BezierCurve = Bezier.new(
SludgeBomb.Position,
SludgeBomb.Position + Vector3.new(0, 200, 0),
Boat.Position + Vector3.new(0, 150, 0),
Boat.Position
)
task.spawn(function()
for i = 1, 5 do
local Percent = (i * 20) / 100
local NewCFrame = CFrame.new(BezierCurve:Get(Percent))
local Tween = TweenService:Create(
SludgeBomb,
TweenInfo.new(
0.2,
Enum.EasingStyle.Linear
),
{
CFrame = NewCFrame
}
)
Tween:Play()
Tween.Completed:Wait()
end
task.delay(1, function()
SludgeBomb:Destroy()
end)
end)
So I need the goal (Boat.Position) to take into account the new position after each percent in the for loop and have it update