Have a look on the archive, the question was yet discussed. As there is no universal ideal solution, you have to define your own level of compromise.
A idea that was given and that I found smart althought poor security level was to make a password protected rar file. Then you can exchange money against password. Unfortunately once the code was given, your script was no longer protected from being sprayed.
But consider the utility of sharing, with all the scripts supplied freely every where, we can improve our own script and get better.
Customers that order you a script must of course pay you.
Up to you.