If the script is not shared, it belongs to the object it is assigned to (ScriptExecutionTask, ScriptAction, etc.) and is deleted when the owning object is deleted. You must not assign a non-shared script to more that one object.
If the script is shared it exists independently of the objects it is assigned to, and can be assigned to be used by any number of objects. If those objects are deleted, the script remains.
Once a script is saved with Shared set to true it cannot be unshared by setting Shared back to false.
To retrieve existing Shared Scripts, use DataContext.GetSharedScript, DataContext.GetSharedScripts, or DataContext.GetObject. Non-shared scripts cannot be retrieved directly but only as part of the object that owns them.