So I was trying to make a script where I can have a player click a part for a gear.
I can’t get the gear from the toolbox, so I wanted to get it by the ID, but I don’t know if this is possible. Can someone help me with this?
InsertService works for Roblox assets without any of the funky ownership stuff they have for regular assets.
Here, substitute GearID
and Player
here for the respective variables you have.
game:GetService("InsertService"):LoadAsset(GearID):FindFirstChildWhichIsA("BackpackItem").Parent = Player.Backpack
9 Likes
Use InsertService
local function giveGear(player, id)
if (player.Character) then
local m = game:GetService("InsertService"):LoadAsset(id)
local t = m:FindFirstChildOfClass("Tool")
if (t) then
t.Parent = player.Character -- make them equip the item
end
m:Destroy() -- cleanup after
end
end
5 Likes
Thanks for the help from both, I am gonna try this.