I copied and pasted it from somewhere. I'll try changing that.
Edit - Well I feel like a jackass. That fixed it. I assumed that was needed for some reason because it was there from the original source I copied it from, but I copied it from so long ago I have no idea where.
Or I suppose another possibility is that I copy/pasted code inside of some parentheses but meant to include the parentheses in what I replaced, but screwed up with the mouse, and have been using this exact script for months.