If I put an instance as a child of game, will it be replecated to clients?

Hello,
If I were to make a folder like so:

image
(ouside of the Workspace)

Would it act like ServerStorage, ReplecatedStorage, or ReplecatedFirst?

1 Like

Undefined behavior. As in, it’s not documented or officially supported and could be changed at any time so don’t rely on it.

I don’t know the exact answer, but you shouldn’t be doing this. Use one of the intentionally made storage services.

4 Likes

^ As the parent of objects cannot be set directly to the DataModel by any LuaSourceContainers of identity <4, this behavior is impossible online.

Script Identity Identity Description
Anonymous [0] Identity level of unknown origin. This level is unable to perform any actions.
LocalGui [1] Any action initiated by Roblox Studio or the mouse. An example would be the expression evaluator.
GameScript (Script/LocalScript/ModuleScript) [2] Execution of a LuaSourceContainer object inside any DataModel
GameScriptInRobloxPlace (Script/LocalScript/ModuleScript) [3] Execution of a LuaSourceContainer object inside any DataModel, if the place was authored by Roblox
RobloxGameScript (CoreScript) [4] Execution of a CoreScript object written by Roblox
Command line (or -script) option [5] Execution of Lua code on Roblox Studio’s command line.
Plugin [6] Execution of Lua code from a plugin.
COM (Backend Server) [7] Execution of Lua code from the backend server.
1 Like

So it would be useful as a storage service of things a developer doesn’t want to REMOVE from his game, and has no reason to replicate to the server or client, but wants to set aside for later use?

No. It’s almost certain that these objects don’t serialize, and wont save locally or online.

…So parenting to nil?

It looks like that, but shouldn’t a rbxlx include all children of Place1? It’s not nil because the explorer realizes it’s there. If it were nil then it wouldn’t be showing up in the explorer, or state “Place1” as the parent.

image

No, I meant if you want a place to store objects you’re not using but want to use later, parent it to nil and store it in a variable.

If you want to use it later but outside of that script, have a temp folder in ReplicatedStorage or ServerStorage.

You spent so long wondering whether or not you could that you failed to ask whether you should.

Why do you even want to do this? The existing containers cover basically all of the potential use cases and clearly show what the objects in them are for.

9 Likes

I’d like to learn this because I think it’s interesting and potentially useful. I usually find uses for strange things, and I have no idea why.

You could try testing this out for yourself.

You shouldn’t find whatever this results in useful because, like I said, it’s undefined behavior and you can’t rely on whatever the result is.

Well, he definitely shouldn’t rely on it, but it doesn’t hurt for him to find out what happens.

2 Likes

Only certain containers (and their descendants) replicate, e.g. Workspace, ReplicatedStorage, …

It’ll exist in the place file, and I think it even exists serverside online because of that, but it won’t replicate.

Since when is that the case? I haven’t been following Roblox much lately, so I have no idea if that’s actually the case, and if so, since when

Per-place plugin storage?

1 Like

Try to run this not in the command bar but in a GameScript (Local or Server)
Instance.new('Part',game)

afaik it’s always been the case.

Opened empty place, pressed Run, inserted regular script in workspace, added code and reloaded the script. Part got added directly to the DataModel (and appears so in Explorer) without causing any error.

Can you try to see if the part replicates to clients if the place is online? (Just print the result of a FindFirstChild in the dev console)

Just ran a test server in Studio. Here’s what happened:

  • Folder visible to server
  • No scripts inside the folder run
  • Folder wasn’t replicated to the client
  • A Server script in ServerScriptService was able to clone the script in the folder and parent it to itself
  • the clone script was able to run

So basically, placing a folder as a direct child of DataModel would be a good option for plugins because this will ensure no scripts will run during the game. It’s basically ServerStorage in that doesn’t allow scripts to run.

6 Likes

ServerStorage doesn’t allow scripts to run.