Are you talking about "frame dropping?" If so like others said, I think that is more a problem with the overall game itself rather than a glitch in the code

I'm no expert, but from my understanding this happens when the game gets "overloaded," much like how old desktop computers would freeze or "glitch out" when you had too many programs opened at once.