<?php the_field(‘header_script'); ?>
But I would like to add to functions.php instead of header.php.
How can I add the snippet to the functions.php?
This should do the trick. Simply add it to your functions document. the \n is a line break to make your code look nicer when it spits it out.