How to Require a package which is a model

so I have a package which is a model, and I’m wondering how I could require it, I tried using the asset Id, but it just complains that there is no module script named “MainModule”, even if I add one, and at this point I’m confused

2 Likes

When you insert something using InsertService it is placed in a new Model, and that new model is returned by LoadAsset
I imagine the confusion is that you’re expecting the ModuleScript to be directly under what LoadAsset returns, while its really one layer deeper

What I upload to roblox:
image

What roblox gives you when you use LoadAsset
image

In order to require my MainModule I would do something along the following:

local model = insService:LoadAsset(12345678)
local module = require(model.MyModel.MainModule)

...
1 Like