To clarify a bit more: debugging is, well, the process of finding bugs in your code so that you can get rid of them. Sometimes, you write a script, and it looks like everything checks out, it compiles fine and the level loads, but then you find out that it does something completely unexpected, or mysteriously stops working, or something along those lines.
If that happens, you can try and investigate what's happening with the values of variables as your code is running, and what methods get called when, etc.
If you set up your development environment as explained in the link above, the ScriptDebugOn() will return true. On the other hand, when you deliver your custom story, when the non-dev users run the script, ScriptDebugOn() will return false. This means that you can use debugging as you're developing the CS or FC, print out diagnostic messages etc., and when a non-dev user runs your level, nothing of it will be shown (or executed).
// let's say you just used some variable called "i"
if(ScriptDebugOn()) // the code below will only execute if ScriptDebugOn() returns true
{
AddDebugMessage("Value of i is: " + i, false); // here false just means not to check for duplicate debug messages
}