-- removes a BezierPoint from the Bezier

function Bezier:RemoveBezierPoint(index: number)
	
	-- check if the point exists
	if self.Points[index] then
		
		-- remove point and remove connections
		local point = table.remove(self.Points, index)
		if typeof(point.Point) == "Instance" and point.Point:IsA("BasePart") then
			for i, connection in pairs(self._connections[point.Point]) do
				if connection.Connected then
					connection:Disconnect()
				end
			end
			self._connections[point.Point] = nil
		end
		
		-- update bezier
		self:UpdateLength()
	end
end

