Long-term FPS drop, and I don't know which script is causing it

I’m working on a game, but the scripts were made by a former developer who, to be honest, wasn’t very skilled. I had to fix the bugs and other issues they left behind. They used libraries like Knit and Janitors. To be honest, I’m not sure how good these libraries are, but I don’t find them impressive, especially if they are the reason for the FPS drops. I’d like to identify which script or piece of code is causing the problem and leading to such a significant performance loss—from 240 FPS to 30 FPS in just 5 minutes.

image
image


Look for unclosed connections like .Touched or with events that get connected repeatedly, look for expensive while true do and repeat until wraps or their similar methods and also look for expensive .RenderStepped RunService connections on the client and expensive .Heartbeat RunService connections on the server. Use the find all replace all tool for this. These connections by themselves are fine but check if they got long yielding code or expensive calculations like spammed use of :GetDescendants or workspace:Raycast. Hopefully this helps.

(Also Knit and Janitor are quite good modules)