Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I insert a Model with a Sript?

I was wondering, if there is a possible way to insert a model from the site with a script? Like, you can insert a brick with a script.

1 answer

✓ Accepted answer

What You Need

For this you need to use InsertService with the LoadAsset function. The LoadAsset function takes one argument, which should be the mode ID that you want to insert.

Limitations

The model being inserted has to be owned by either of the two;

  • The Developer of the game it is being inserted into
  • ROBLOX

Code

--First, load the model.
local model = game:GetService('InsertService'):LoadAsset(247458463)
--Now, since the model is nil at this point, parent it.
model.Parent = workspace

NOTE: The model inserted will be inside of a model object upon insert. So say you insert a script and use the method above, you have to index 'model' for the script

3 comments

0

Thanks, so much.

1

Use game:GetService("InsertService"):Load(model), instead of setting the parent to workspace. If you make a variable for the insert service it could look like: IS:Insert(model)

0

The Load method of InsertService does the same thing as parenting it to workspace, but yes.. roblox functions are prefeable.

This discussion is preserved as it was. New answers, comments, and votes are closed.