I’m sure it’s not a big difference if there is one, but here’s my question:
Say there’s a script in ServerScriptService, and it relies on a source object or several source objects to clone into the workspace/somewhere in the workspace. For example, the script uses an accessory or several accessories which it clones onto a player when they spawn. Only this script uses the accessory(s).
Would putting the accessory(s) in ServerStorage have some sort of benefit over leaving it inside the script in ServerScriptService?
‘Benefit’ on performance or memory, even if very little
Putting the script in ServerScriptService will actually run the script. Putting it in ServerStorage won’t.
If you mean whether putting the Accessory inside the Script in ServerScriptService or ServerStorage will be faster, it doesn’t matter at all. Pick whatever’s going to be the most readable.
Putting it inside of the script might have slightly higher performance (especially if you’re not going to cache a pointer to the attachment inside of the script/its parent) because scripts have a global variable that references to themselves (which is why you can do stuff like script.Parent or index script in your case for script.Accessory)
Btw I’m not entirely sure of this but:
Because you have a pointer to the script - and the accessory is only one pointer away, chances are, it will be loaded in one of your system’s fast caches (and won’t stay in RAM) whereas if there is a big separation between the closest pointer to the Accessory in ServerStorage, especially if it has a lot of children since it might not be able to have all its pointers cached due to the amount of storage it would require (your fast caches have little storage) (if the closest pointers are something like game or workspace, it might be especially severe), it might not be stored in one of the fast caches and instead be in RAM, which will take longer to lookup
Of course this can all be resolved by just creating local pointers to the objects you need to reference instead of indexing
It all comes down to how you want to organize it. I like my assets in ServerStorage, not in scripts under SSS. I only put modules and scripts in SSS, never any other assets unless I’m really lazy.
It’s called server script service for a reason. It’s intended for scripts, not objects. It’s more preferable to use ServerStorage, as you never know if they will remove the ability to put non-script objects into serverscriptstorage.
Overall, it’s better to put it in ServerStorage, but it’s somewhat up to personal preference.
For sake of compatibility, it is extremely unlikely that Roblox would restrict members of ServerScriptService to LuaSourceContainers only. @RuizuKun_Dev is right however. ServerScriptService exists and is useful because it doesn’t replicate to clients and runs Server scripts (obviously) while ServerStorage exists and is useful because it doesn’t replicate to clients and doesn’t run any BaseScript objects under it.