I've been working on a lua mod for a while, thinking of publishing it to TPT, and I came across a big problem with lua scripts. LAG. The biggest element in question is the element COPR I made, based off of a forum suggestion I saw a few days ago. Just around 800 pixels (that's a lot less than you might think) halves my fps, and and normal amounts of the stuff brings the game down to under 10 fps. Am I doing something wrong? If not, are there any good ways to make the script more efficient? Any feedback is helpful, even if not specifically for this element. Thank you for your time and help!
That would certainly cause some problems! I'll fix that.
It helps a bit, but the element is still almost as laggy as ever.
I made a few variable changes. Version 2 has been uploaded to the same drive file now. That would be great if you could help make it less laggy.
I tried to make it less laggy by reducing the usage of the TPT API functions
https://pastebin.com/raw/HBqVCzCZ
That worked so well! Thank you! Do TPT API functions make it worse? I'm new to lua scripts, and thought that it was better to use those than variables.