# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/create-a-custom-keycard-item-in-fortnite
# Local doc: epic-docs/documentation/en-us/fortnite/create-a-custom-keycard-item-in-fortnite.md
# Section: Write the Verse Code for Gameplay
# Helper function that gets the first descendant inventory component from an agent.
# This will be the root inventory.
GetAgentInventory(Agent:agent)<decides><transacts>:inventory_component=
TragetInventory := (for (I : Agent.FindDescendantComponents(inventory_component)) { I })[0]
Verse Library
verse
03 Write The Verse Code For Gameplay
Locates and returns the first inventory component attached to a given game agent for item access.
extracted-snippets/documentation/en-us/fortnite/create-a-custom-keycard-item-in-fortnite/03-write-the-verse-code-for-gameplay.verse