I believe this is not related to the script.
If you follow the original thread, you should've known that this might have to do with npctalk script command. You can always disable the npctalk part if you want to not get the error. Original thread is attached below: