I know there are many plugins to import catalog items to games, but I would like to do this inside a game. How would I import a catalog item into the game? I’m trying to import catalog accessories.
I tried insert service and it doesn’t seem to work.
Thanks for any help!
4 Likes
What type of catalog items?
Try this insert service code, (I’m not sure about packages, etc.)
local id = 0 -- ID
game:GetService("InsertService"):LoadAsset(id).Parent = game.Workspace --load the asset and move to workspace or your desired location, you can also not parent it while loading, parent the root of the hat, and then put it in workspace
12 Likes
should have been more specific - i’m trying to import accessories
3 Likes
This works for accessories, just change the ID. (I forgot to add more to the post and explain it better, oops)
2 Likes
I used your script with an accessory ID (62803186) and it did not appear in workspace when running the game. The script is a server script in workspace and the item is created by ROBLOX (just for testing) (Trollin' Pumpkin - Roblox).
2 Likes
Worked for me, I imported mine via the command bar.
Obviously, this code can be tweaked to anchor, move, and equip.
4 Likes
It worked for me over command bar as well game:GetService("InsertService"):LoadAsset(62803186).Parent = game.Workspace
but it does not appear in workspace when using that same line of code in a script and running the game
4 Likes
Might be because the part is nocollide and falls out into the void.
1 Like
I could try it with a hat, didn’t realize until i imported that that’s a tool not a hat
2 Likes
I think you’re right about them falling into the void because I see two models at game start but then they disappear.
2 Likes
I tried this in a script, but the item still does not appear where it should. I checked, and the handle is set to cancollide true.
Am I using :findfirstchild() correctly to get the accessory in the hat?
When imported over command line it returns a model with the accessory:
local hat = game:GetService("InsertService"):LoadAsset(215751161)
hat.Parent = game.Workspace
hat:FindFirstChild().Handle.Position = Vector3.new(-468.875, 103.151, -247.79)
hat:FindFirstChild().Handle.Anchored = true
2 Likes
First, FindFirstChild() should have a string inside of the parentheses:
I added a :MoveTo() which replaces the vector3 (That can be changed.)
local hat = game:GetService("InsertService"):LoadAsset(215751161)
hat.Parent = game.Workspace
hat:MoveTo(Vector3.new(0,1,0))
hat:WaitForChild("Handle").Anchored = true
11 Likes