I’ve tried executing code below in console(server side), studio cmd bar, server side in testing, and none of them added the intended item into the game. I am trying to add a gear (Linked Sword) into my game.
game:GetService("InsertService"):LoadAsset(125013769)
1 Like
I don’t see the gear anywhere in workspace, and console gives me no errors.
The issue had nothing to do with the Command Bar. You should try to run it there once again.
1 Like
I was mistaken. You should try game:GetService("InsertService"):LoadAsset(125013769).Parent = workspace;
instead.
Previously, I had thought that LoadAsset
returned an array of objects, though this functionality is implemented by DataModel:GetObjects
that does this. InsertService:LoadAsset
instead returns a Model containing the objects (Instances) to the asset.
The semicolon is not necessary, it is used to mark the end of an expression. print("Hello World!")
and print("Hello World!");
have the same function.
2 Likes
It worked, what did you change?
When you insert an asset using insertservice, it appears as a model in workspace. Look inside your workspace for something named “Model” then look inside and you should see your gear.
3 Likes
I know, I did it before, the problem was that I wasn’t setting parent of model to workspace, I tried setting it’s parent to workspace but didn’t know I had to add the ‘;’ at the end.