Luau Reflection DataModel Issue - require() caches full locations to Instances as well, and won't update child elements until reload

Description

What is a cached Instance? Does that exist?

No, I don’t think it does in a DataModel. But if you :Clone() an Instance, at least then you’d have a copy of it with a snapshot of all Instances that were a child of it, at the time you cloned it.

 

If you’re returning an Instance, like game.ReplicatedStorage.Folder through a ModuleScript, that essentially is a “path” and not a clone…

There’s no autocomplete for it.

But… the ClickDetector. It’s right there. And both are the same instances!!

Re-production Steps

This happens in the Old and New Solver

  1. Inside ReplicatedStorage create a Folder and put whatever you’d like into it.
    image

  2. Create a ModuleScript where ever you’d like.

  3. Put this inside the ModuleScript

Script
local module = {}

module.An_Instance = game.ReplicatedStorage.Folder

return module
  1. Make sure to click “Reload Script” at the top area in Studio!
  2. Create a Script
  3. Put this inside the Script
Script
local test = require(game.ServerStorage.ModuleScript)

local REAL_INSTANCE = game.ReplicatedStorage.Folder
  1. Now go to game.ReplicatedStorage.Folder
  2. Put more things into the Folder.
    image
  3. Go back to the Script and try to autocomplete REAL_INSTANCE and test

 

Expected Result

If it’s an Instance, I thought I will always get the autocomplete, even if I put new Child Elements into the Instance.

I am NOT:

  • Returning a :Clone
  • Nor returning Instance.new()

I am returning a full path to an Instance. But, does Luau understand what a path to an Instance is? :thinking:

Actual Result

If I made a ModuleScript that contains module.An_Instance = game.ReplicatedStorage.Folder, or returns an Instance in any way. It seems to memorize all the things the Instance contained at that time, once you click “Reload Script”.

This is persistent until you refresh Studio or re-reload the ModuleScript.

If I add new Child Elements to the same Instance that I returned, it is not going to update it, while a true variable does update it.

1 Like

This is just an acknowledgment announcement!

We’ve filed a ticket into our internal database for this issue, and we will update you when we have further information!

Thanks for the report!