How to optimize game servers?

So my game used to have bad servers since I am not a professional, so I was wondering can anybody tell me a script to optimize game servers?

There are no scripts which can optimise your game for you. However, here are some tips to make sure your game’s code is efficient:

  • Dispose all instances such as parts after use.
  • Disconnect events such as .Touched once it no longer serves a purpose in order to prevent memory leaks
  • Try using module scripts instead of scripts (this is for organisational purposes only)