I'm trying to make a game where you can input an ID into a textbox and it will give the asset to you. How would I check to see if it is either an accessory or a tool, not just an accessory? (It inserts if it is an accessory)
Here's the server script (in replicated storage):
game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(player, assetID, backpack, plr)
local InsertService = game:GetService("InsertService")
print(player, plr, assetID)
print("accessory?")
if InsertService:LoadAsset(assetID):IsA("Accessory") then
InsertService:LoadAsset(assetID):FindFirstChildWhichIsA("Accessory").Parent=workspace:FindFirstChild(player.Name)
print("accessory.")
print("tool?")
elseif InsertService:LoadAsset(assetID):IsA("Tool") then
InsertService:LoadAsset(assetID):FindFirstChildWhichIsA("Tool").Parent=backpack
print("Tool.")
end
end
