How would you grant items to someone who interacts with a button?

I am really new to unreal engine, and mainly the coding aspect of it with verse being my first language. So I am really unsure how to grant an item when a player interacts with a UI button. I am using the script that was provided on the documentation website. I understand that you need an agent for the ‘GrantItem()’ function. However I have been unable to figure out this out. Thanks for the help. I have provided my script below.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/SpatialMath}

# A Verse-authored creative device that can be placed in a level
WeaponLoadoutUI := class(creative_device):

     @editable
     MyButton : button_device = button_device{}
     @editable
     Weapon1:item_granter_device = item_granter_device{}

     TextForMyUI<localizes> : message = "Weapon 1"

     var MaybeMyUIPerPlayer : [player]?canvas = map{}

     OnBegin<override>()<suspends> : void =
         MyButton.InteractedWithEvent.Subscribe(HandleButtonInteraction)


     HandleButtonInteraction(Agent : agent) : void =
         if (InPlayer := player[Agent], PlayerUI := GetPlayerUI[InPlayer]):
             if (MyUI := MaybeMyUIPerPlayer[InPlayer]?):
                 PlayerUI.RemoveWidget(MyUI)
                 if (set MaybeMyUIPerPlayer[InPlayer] = false) {}
             else:
                 NewUI := CreateMyUI()
                 PlayerUI.AddWidget(NewUI, player_ui_slot{InputMode := ui_input_mode.All})
                 if (set MaybeMyUIPerPlayer[InPlayer] = option{NewUI}) {}

     CreateMyUI() : canvas =
         MyUIButton : button_quiet = button_quiet{DefaultText := TextForMyUI}

         MyUIButton.OnClick().Subscribe(HandleSelectedUIButton)

         MyInteractableButtons : canvas = canvas:
             Slots := array:
                 canvas_slot:
                     Anchors := anchors{Minimum := vector2{X := 0.25, Y := 0.5}, Maximum := vector2{X := 0.5, Y := 0.5}}
                     Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                     Alignment := vector2{X := 0.5, Y := 0.5}
                     SizeToContent := true
                     Widget := MyUIButton

         return MyInteractableButtons

     HandleSelectedUIButton(Message : widget_message) : void =
         if (PlayerUI := GetPlayerUI[Message.Player], MyUI := MaybeMyUIPerPlayer[Message.Player]?, SelectedButton := text_button_base[Message.Source]):
             Print("Player selected {SelectedButton.GetText()}")
             PlayerUI.RemoveWidget(MyUI)
             if (set MaybeMyUIPerPlayer[Message.Player] = false) {}
             if (GrantPlayer := InPlayer?):
                Weapon1.GrantItem(GrantPlayer)