Why is this causing my game to crash?

I’m putting a pastebin link because when I use the code in brackets it screws up the formatting. Plus the code is kinda of long. I’m trying to add trails and I believe that is what is causing the game to crash, but I’m not sure what part of the trails is causing it to crash.

Link: http://pastebin.com/Un48gMFx

Have you tried commenting out potential crash sources?