If I have streaming enabled, but I store references to instances in a table for later use, what happens to those references when the instance is streamed out. Also, what happens to them when the instance is streamed back in?
I’ve had this question as well, but now that I think about, it’s pretty easy to understand.
If I’m not mistaken, when an instance is streamed out, it’s parent is temporarily set to nil, meaning you can still get or set it’s properties as long as you have a reference to it. I don’t think you can access the instance’s children while it is streamed out, however.
When it’s streamed back in, I’m 99% sure that it’s reparented under the workspace/it’s pre-existing parent.
If you were asking for a more detailed response, then I probably can’t help since I don’t really know all that much about weak tables, etc.
A reference to an instance which streams out and/or back in will always exist as long as it doesn’t get garbage collected. That means you can always use it to modify properties of an instance even when it is streamed out.
Streamed out instances have their parent set to nil. However, when they stream back in, their properties change to match that of what they are on the server. So any local changes are lost.
If you’d like to know how instances work in weak tables, take a look at this video: https://youtu.be/K6TryCAqFbs?feature=shared&t=618
hey man, please note that instances are only streamed out on the client, meaning you still have full access to them and all their children on the server. Like @Fliktem said, you will still be able to modify properties of a referenced instance once it is streamed out; however you will not be able to access it’s children. If you are storing references and need its children, it is best practice to do so on the server or turn the streaming mode to persistent.