Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I insert a Model with a Sript?

Asked by 9 years ago

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

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

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

0
Thanks, so much. nforeman 15 — 9y
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) EzraNehemiah_TF2 3552 — 9y
0
The Load method of InsertService does the same thing as parenting it to workspace, but yes.. roblox functions are prefeable. Goulstem 8144 — 9y
Ad

Answer this question