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

Spawn a model with a script?

3 answers

✓ 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

So, for your purposes.. your ID is 247458463, so we'll use the LoadAsset function with that as the arguments.

--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

2 comments

1

Hypocrite. You said you didn't have to own the model for it to be inserted.

0

Well I'm sure "ROBLOX" owns the model stated in the example the OP provided.

Yes, it is possible. Use InsertService.

local insertService = game:GetService("InsertService")
local modelId = 42069 --change this to the model ID, the string of numbers at the end of a model's link

local model = insertService:LoadAsset(modelId)
model.Parent = workspace

Please note that you need to own the model to be able to insert it from scripts in-game, as stated here.

4 comments

0

I legit did not notice you answered xd

0

You don't have to own the model for it to be inserted..

0

It says so on the wiki. Please go to the link, although I haven't used InsertService in my own scripts.

game:GetService("InsertService"):LoadAsset(247458463).Parent = workspace

You must own or have the model.

1 comment

0

You don't have to own the model for it to be inserted..

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