Why do empty spaces cause syntax error?

I’ve had the same issue.

I suspect when you copy scripts from the developer site you use double click to select all, as their tool tip suggests.

For some reason this ads a few blank or “space” ascii characters to the copied script. I’ve found if you select all text by the normal click and drag way (bottom to top is easiest), you avoid this issue.