Why is the server/user freezing for a few seconds?

Hi! I am a novice scripter in roblox studio, and I would like to find out why and how the server/user freezes for a few seconds or even more due to that I call for loops a lot without wait(). Is it possible to fix it somehow or reduce this probability?

this question is very vague.

you need to provide much more detail to help us understand what the issue is.

by freezing, do you mean that the server latency shoots to a very large number?
does this occur when trying to execute a certain script?

the developer console (you can access it by pressing F9) provides a lot of tools to see how much of a load is being applied to the server/ client

the server stats section will show you how much data is being sent from the client, which directly corelates to the servers avg. ping. the higher the avg. ping, the longer the game will ‘freeze’

For example: I have a regeneration script, in which if i/server run it, the server or client will freeze for 10-20 seconds

This is the main part of regeneration:

Maybe add a few yields in there to give the thread a break.