I have discovered what the problem was. The batch pen trails option was on for my playfield causing some of the lines not do be shown. But I am still not sure why this only happened when I used a button to fire the script.
 
However I now have another problem. When I fire the script with a button it draws the first two sides at the same time and then draws the others. I want to be able to see all of the lines being drawn (like it does when you start it manually). Is this normal? Or is there something else I need to do, that I have not yet discovered? Thanks
 
Regards
 
Kelly