Why wont my require(assetId) work?

This is the code in a normal script:

require(8484932897).Parent = script.Parent

When I press play, the console says it is requiring the asset, but it doesn’t. The asset is named MainModule. It’s only for this one too, other assets load.

Does anyone know why?

Requiring a asset doesn’t move the module into the game it just gives you the functions inside of it(Like when you require them normally).
It also doesn’t throw a error when trying to set the Parent.

That being said if you need the module itself look into InsertService specifically InsertService:LoadAsset(). Which will work fine with your code since it returns the module itself as a object.

1 Like

Apparently require does not create an instance of the script, but rather executes the ModuleScript without it even manifesting in the workspace. Setting Parent results in creating an attribute to it unknowingly, much like the explanation above.

Thank you very much! This helped me a lot!