I’m experiencing a lag issue that I’ve been trying to resolve. I put my project away for a while to focus on other things, and came back to some painful lag when:
Changing brick color
Changing brick transparency
In order to diagnose the cause of the lag I’ve disabled all scripts and have gone through each of them.
With all other scripts disabled, this is causing lag (and also occurs if I change the brick color of a single brick as well):
local teleporter = script.Parent
while true do
teleporter.Transparency = 0
wait(3)
teleporter.Transparency = 1
wait(3)
end
Not that this is not a device issue.
Reproduced on:
Mobile
A system running an i7 (8th gen), 16GB mem
A system running an i7 (10th gen), 32GB mem, dedicated graphics card
While # 3 was is least painful, the lag is still noticeable
Has anybody experienced this, or have any ideas on how to resolve such an issue?
You may have a data leak inside your game, I do not know how to fix that but changing brickcolors certainly should not cause lag, unless you are changing it without very much delay. The brickcolor could be connected to lots of events which can cause lag. Although I believe it is a memory leak.
Either you missed a script or this script is in 1000s of objects, because that code will not cause any lag. Are you sure there is no other code running? It’s also not lagging in 3 second intervals.
Single script inside single block.
Looped through and disabled all other scripts within the context of the place and performed many tests, including disabling and enabling the sample (which causes the lag in the vid)
That code will not cause lag on its own. Is the teleporter part getting cloned many times? Are you disabling the scripts after the game is run or before the game is run?
If other scripts were enabled I could possibly agree that it could be a memory leak of sorts. As you can see in the script block posted, there is a long enough wait.
All other scripts were disabled before publishing and testing in order to narrow down where the problem exists. The teleporter block in this instance is static; nothing is getting cloned. Currently, the script containing the code block posted is enabled.
Before I stopped working on the project for a while these issues did not exist, so it’s somewhat confusing. I had a handful of models running color change scripts previously without issue.