I want to make it less laggy
I spike to around 40-30 fps when it shoots the arrow
if H:GetAttribute("SpinSpeed") then --spin speed if when projectile is spinning
local SpinSpeed = H:GetAttribute("SpinSpeed")
for i=0, 1, .2 do
local tweenInfo = TweenInfo.new(Speed, Enum.EasingStyle.Linear)
TW:Create(Projectile, tweenInfo, {CFrame = CFrame.new(Curve.quadraticBezier(i, PointA, PointB, PointC)) * CFrame.Angles((i * 10) * SpinSpeed,0,0)}):Play()
wait(Speed)
end
else
for i=0, 1, .2 do
local tweenInfo = TweenInfo.new(Speed, Enum.EasingStyle.Linear)
TW:Create(Projectile, tweenInfo, {CFrame = CFrame.new(Curve.quadraticBezier(i, PointA, PointB, PointC)) * CFrame.lookAt(Projectile.Position ,Curve.quadraticBezier(i + 0.1, PointA, PointB, PointC)).Rotation}):Play()
wait(Speed)
end
end
local Curve = {}
function Curve.lerp(a, b, t)
return a + (b - a) * t
end
function Curve.quadraticBezier(t, p0, p1, p2)
local l1 = Curve.lerp(p0, p1, t)
local l2 = Curve.lerp(p1, p2, t)
local quad = Curve.lerp(l1, l2, t)
return quad
end
return Curve
I tried to make it iterate less but it didn’t do anything