How to identify if the script is being debugged, using code?

I found this:

However, I don’t know how to use it.

Could anyone show a practical example to print something if the script is being debugged?

Why am I asking how to identify via code if a script is being debugged?
Because of this problem:

In short, I am at a dead-end:

  1. I cannot save data inside the DataStore while using Studio;
  2. If I want to do this, I need to activate BindToClose and there, wait 3 seconds for the SetAsync operation to be completed by Studio, before the server is shut down;
  3. But if I activate BindToClose, every time I stop debugging, Studio freezes 30 seconds;
  4. The only solution, then, would be to have some instruction that identifies if Studio is in debugging. Then it would be easy: in this case, it would be enough not to execute BindToClose.
  5. This would solve both the save within the Studio and “in-game”.

But apparently, there is no way to identify whether Studio is debugging, via code …
Serious limitation … Am I right?

Although there is no solution for this OP, at least I found a solution to avoid the Studio 30 seconds freezing, as I mentioned in Post 2: