How do I summon scripts with another script?

So, I’m making an updated version of a model for a community I’m making. I want to be able to edit scripts for this model remotely so I can pretty much publish an update across ROBLOX to fix/update issues with the scripts without all the other model users having to do it. I’m not sure if that makes sense, but it’s a little difficult to explain.

Basically, I want to use LoadAsset to spawn in a model (which will consist of a few scripts) and automatically place them in my tool. The LoadAsset feature would allow me to edit those scripts remotely and simply overwrite the original model.

However, I have also seen this done using require(), however I thought require was only for modulescripts. Would it be more effective to use require and then use a modulescript to spawn in the other script model? I’m not really sure. An example of this can be seen below:

local Module = require(4866183726)
Module.LoadPistol(script.Parent)

I’m not actually sure how to replicate a system like the above. What I have currently looks like this:

local player = game.Players.LocalPlayer
local model = game:GetService(‘InsertService’):LoadAsset(6660057356)
model.Parent = script.Parent

for i, v in pairs(model:GetChildren()) do
v.Parent = script.Parent
end

model:Destroy()
script:Destroy()

Obviously, I’m aware the above is a very very inefficient way to do what I’m looking for. And, it also runs into issues, where the scripts seem to be firing at an inappropriate time, for something. :WaitForChild() functions throw an “infinite yield possible” error when I spawn in scripts this way.

So, my main question is what the best way to do this is to make these scripts accessible to everyone in a way where I can still remotely update them without the model user actually having to do anything to update it themselves.

Your requirement to “publish an update across ROBLOX” may be problematic depending on what you mean.
Have a look at these:

Groups cannot take models, so there is no way to do this in group-owned games.

I’ve seen this done before, I’m not exactly sure how it works. I’m using models right now that do exactly what I’m aiming to do, I just don’t know how to execute it myself.

I’m not too worried about a “live” updated being published, just as long as the developers/model users don’t have to update the scripts themselves I’ll be fine I think (even if that requires server restarts to take effect)

As for the reply you made about requiring a modulescript twice, would you be able to use a serverscript, require() a modulescript model to spawn it in, and then use the modulescript to set up the rest of the scripts with LoadAsset()? I’m still confused generally about how to go about actually doing this.

Since require caches, the idea, for a “re-require” is to require a new/different script/model. Interestingly,
this can be done by requiring a same-named object in the same spot in an object hierarchy, so for instance
you clone a ModuleScript, give it a name for that spot and place it there (and trash the old one) and
then “re-require” it (the cloned ModuleScript loads and fresh-requires the asset, and does whatever you need to do with the Model’s “MainModuleModuleScript, eg. requiring, reparenting, cloning, …)

As far as the sentence you quoted from the feature request–That may have been referring to some
edge-case that might not be relevant for you.

Instead of using LoadAsset you may want to instead set up your code so that all the functional scripting is in the module script you load. You can rename a module script “MainModule” and then save it to your inventory. You’ll want to have all the other module scripts, models, parts, ect. that you want to use as a child to it as well. Then in the main module you can how it interacts with your script or if it will act as it’s own script. Copy the AssetId of the saved module and then in your main script use:

require(293495) -- This is an example. Use the AssetId you copied here. I don't even know if this is a real or usable AssetId.