I have a modulescript (A) with a “Generator” Instance Attribute set to another modulescript (B). This is the code i am running in the first modulescript (A):
local GeneratorModule = script:GetAttribute("Generator")
print(typeof(GeneratorModule)) --Should be "Instance", is actually "InstanceHandle"
I would expect this to print “Instance”, but i am instead being met with “InstanceHandle”
Attempting to require the “InstanceHandle” results in an error as it isnt a valid type for require.
Ive searched the engine documentation and i cant find anything about “InstanceHandle”
What is this “InstanceHandle” type and how can i instead get the actual instance?
In the announcement post its mentioned that you need to use :Get() on the InstanceHandle to get the instance. So just do GeneratorModule:Get() to get the actual instance.
This is new Instance Attributes feature that was just released in the recent studio update. When you set an attribute to an Instance, roblox now returns an InstanceHandle (safe pointer/wrapper) instead of the raw Instance to prevent errors with StreamingEnabled if the target instance hasn’t loaded yet
To get the actual ModuleScript you need to use :Get() or :Wait() method on that handle