Putting an entire place file in a thread and mentioning that it has a problem is not appropriate use of this category. Please refer to the Scripting Support category guidelines for more information on how to structure a post or what to include in it at the minimum.
It would be most helpful if you provided an explanation of the issue you’re encountering, if you’ve researched into the problem (either by reviewing your code or searching related problems) and whether or not you’ve attempted to debug this code and how that was done.
As it stands now, there’s no indication of where a source may be, with the only provided information being from the start of the script to line 503. That’s a very huge chunk to review for what could potentially be a small problem.