Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to reduce exponential lag from script use?

Asked by 2 years ago

This script here;

001local RockScript = require(game.ServerScriptService.RockScript)
002print(RockScript.allrocktable)
003 
004rock = script.Parent
005local startpos = rock.Position
006table.insert(RockScript.allrocktable, rock.Position)
007 
008no_right_rock = 0
009no_left_rock = 0
010no_back_rock = 0
011no_front_rock = 0
012no_up_rock = 0
013no_down_rock = 0
014 
015local toolactive
View all 211 lines...

Works fine the first 6 or so runs and then it starts to lag, very, very badly, as shown in this video https://vimeo.com/806579252

Hopefully you can see it lags more and more every use, I have no idea what causes it, any help is appreciated.

1 answer

Log in to vote
1
Answered by 2 years ago

I feel a bit stupid, I really didn't think the prints were the issue, but after spending a while trying other things, i get rid of them, and surprise surprise, there's no lag. It also makes sense that was problem since printing the table would get harder and harder each time.

Ad

Answer this question