function BezierCurve.LinearBezierCurvesLookAt(A,O,V,p,c,Q)local Z=Instance.new("\080\097\114\116")Z.Parent=V Z.Transparency=1 Z.Size=Vector3.new(1,1,1)Z.Anchored=true Z.CanCollide=false if typeof(p)~="\086\101\099\116\111\114\051"then p=p.Position end if typeof(c)~="\086\101\099\116\111\114\051"then c=c.Position end for x=0,A,1 do local M=x/A Z.Position=BezierCurve.Lerp(p,c,M)if x==0 then continue else V.CFrame=CFrame.lookAt(V.Position,Z.Position,Vector3.new(0,1,0))*Q V.Position=Z.Position end task.wait(1/O)end Debris:AddItem(Z,task.wait())end function BezierCurve.QuadraticBezierCurvesLookAt(A,O,V,p,c,Q,Z)local x=Instance.new("\080\097\114\116")x.Parent=V x.Transparency=1 x.Size=Vector3.new(1,1,1)x.Anchored=true x.CanCollide=false if typeof(p)~="\086\101\099\116\111\114\051"then p=p.Position end if typeof(c)~="\086\101\099\116\111\114\051"then c=c.Position end if typeof(Q)~="\086\101\099\116\111\114\051"then Q=Q.Position end for M=0,A,1 do local Y=M/A local l=BezierCurve.Lerp(p,c,Y)local C=BezierCurve.Lerp(c,Q,Y)x.Position=BezierCurve.Lerp(l,C,Y)if M==0 then continue else V.CFrame=CFrame.lookAt(V.Position,x.Position,Vector3.new(0,1,0))*Z V.Position=x.Position end task.wait(1/O)end Debris:AddItem(x,task.wait())end function BezierCurve.CubicBezierCurvesLookAt(A,O,V,p,c,Q,Z,x)local M=Instance.new("\080\097\114\116")M.Parent=V M.Transparency=1 M.Size=Vector3.new(1,1,1)M.Anchored=true M.CanCollide=false if typeof(p)~="\086\101\099\116\111\114\051"then p=p.Position end if typeof(c)~="\086\101\099\116\111\114\051"then c=c.Position end if typeof(Q)~="\086\101\099\116\111\114\051"then Q=Q.Position end if typeof(Z)~="\086\101\099\116\111\114\051"then Z=Z.Position end for Y=0,A,1 do local l=Y/A local C=BezierCurve.Lerp(p,c,l)local X=BezierCurve.Lerp(c,Q,l)local S=BezierCurve.Lerp(Q,Z,l)local L=BezierCurve.Lerp(C,X,l)local v=BezierCurve.Lerp(X,S,l)M.Position=BezierCurve.Lerp(L,v,l)if Y==0 then continue else V.CFrame=CFrame.lookAt(V.Position,M.Position,Vector3.new(0,1,0))*x V.Position=M.Position end task.wait(1/O)end Debris:AddItem(M,task.wait())end return BezierCurve
------------------------------|åˆ†å‰²çº¿|------------------------------

function BezierCurve.LinearBezierCurvesLookAt(Frame, FPS, Target, Position1, Position2, CFrameOffset)
	local CFramePart = Instance.new("Part")
	CFramePart.Parent = Target
	CFramePart.Transparency = 1
	CFramePart.Size = Vector3.new(1, 1, 1)
	CFramePart.Anchored = true
	CFramePart.CanCollide = false

	if typeof(Position1) ~= "Vector3" then
		Position1 = Position1.Position
	end

	if typeof(Position2) ~= "Vector3" then
		Position2 = Position2.Position
	end

	for Index = 0, Frame, 1 do
		local Time = Index / Frame

		CFramePart.Position = BezierCurve.Lerp(Position1, Position2, Time)

		if Index == 0 then
			continue
		else
			Target.CFrame = CFrame.lookAt(Target.Position, CFramePart.Position, Vector3.new(0, 1, 0)) * CFrameOffset
			Target.Position = CFramePart.Position
		end

		task.wait(1 / FPS)
	end

	Debris:AddItem(CFramePart, task.wait())
end

function BezierCurve.QuadraticBezierCurvesLookAt(Frame, FPS, Target, Position1, Position2, Position3, CFrameOffset)
	local CFramePart = Instance.new("Part")
	CFramePart.Parent = Target
	CFramePart.Transparency = 1
	CFramePart.Size = Vector3.new(1, 1, 1)
	CFramePart.Anchored = true
	CFramePart.CanCollide = false

	if typeof(Position1) ~= "Vector3" then
		Position1 = Position1.Position
	end

	if typeof(Position2) ~= "Vector3" then
		Position2 = Position2.Position
	end

	if typeof(Position3) ~= "Vector3" then
		Position3 = Position3.Position
	end

	for Index = 0, Frame, 1 do
		local Time = Index / Frame

		local Lerp1 = BezierCurve.Lerp(Position1, Position2, Time)
		local Lerp2 = BezierCurve.Lerp(Position2, Position3, Time)

		CFramePart.Position = BezierCurve.Lerp(Lerp1, Lerp2, Time)

		if Index == 0 then
			continue
		else
			Target.CFrame = CFrame.lookAt(Target.Position, CFramePart.Position, Vector3.new(0, 1, 0)) * CFrameOffset
			Target.Position = CFramePart.Position
		end

		task.wait(1 / FPS)
	end

	Debris:AddItem(CFramePart, task.wait())
end

function BezierCurve.CubicBezierCurvesLookAt(
	Frame,
	FPS,
	Target,
	Position1,
	Position2,
	Position3,
	Position4,
	CFrameOffset
)
	local CFramePart = Instance.new("Part")
	CFramePart.Parent = Target
	CFramePart.Transparency = 1
	CFramePart.Size = Vector3.new(1, 1, 1)
	CFramePart.Anchored = true
	CFramePart.CanCollide = false

	if typeof(Position1) ~= "Vector3" then
		Position1 = Position1.Position
	end

	if typeof(Position2) ~= "Vector3" then
		Position2 = Position2.Position
	end

	if typeof(Position3) ~= "Vector3" then
		Position3 = Position3.Position
	end

	if typeof(Position4) ~= "Vector3" then
		Position4 = Position4.Position
	end

	for Index = 0, Frame, 1 do
		local Time = Index / Frame

		local Lerp1 = BezierCurve.Lerp(Position1, Position2, Time)
		local Lerp2 = BezierCurve.Lerp(Position2, Position3, Time)
		local Lerp3 = BezierCurve.Lerp(Position3, Position4, Time)

		local InLerp1 = BezierCurve.Lerp(Lerp1, Lerp2, Time)
		local InLerp2 = BezierCurve.Lerp(Lerp2, Lerp3, Time)

		CFramePart.Position = BezierCurve.Lerp(InLerp1, InLerp2, Time)

		if Index == 0 then
			continue
		else
			Target.CFrame = CFrame.lookAt(Target.Position, CFramePart.Position, Vector3.new(0, 1, 0)) * CFrameOffset
			Target.Position = CFramePart.Position
		end

		task.wait(1 / FPS)
	end

	Debris:AddItem(CFramePart, task.wait())
end

return BezierCurve
