Hello!
I’m currently making a sandbox do-anything type of game to stretch my coding experience. This has been going well and I’ve learned a lot, but now I’m stumped. I’m trying to let the player load assets from the catalog into the game, such as gear and accessories. So far I’m using LoadAsset() for this.
Here’s the problem; When you use LoadAsset() it turns the asset into a model. This means that when I load gear it won’t let the player use it, despite it being in their backpack.
My only solution right now is to perform a manual check through code to see if the model’s child is a tool or an accessory or whatever, however that’s not 100% Ideal to me as I think it adds unnecessary code to my script.
Is there a way to retrieve what kind of asset it is through a function?
Current Code (Local script sends event with ID from a textbox to the server)
local function insert (player, id, hum)
local asset = game:GetService("InsertService"):LoadAsset(id)
asset.Parent = game.Workspace:FindFirstChild(player.Name.."AssetFolder")
asset.Parent = game.Players:FindFirstChild(player.Name).Backpack
end
game.ReplicatedStorage.Events.Insert.OnServerEvent:Connect(insert)
The result:
Thank you!