Error (3509)

PurchaseButton.OnClick().Subscribe(PurchaseItem(Index))

How could I pass the index in this situation?

Error:
This function parameter expects a value of type widget_message->void, but this argument is an incompatible value of type void.(3509)

This function parameter expects a value of type tuple(widget_message,int), but this argument is an incompatible value of type int.(3509)

    PurchaseItem(Message : widget_message, ItemDataIndex : int) : void =
        Player := Message.Player

        if (ShopItemConditional := ItemConditional, 
        ShopItemGranter := Item_Data[ItemDataIndex].ItemGranter, 
        Shop_Item_Price := Item_Data[ItemDataIndex].ItemPrice):
            
            KeyIndex := 0
            ShopItemConditional.SetItemCountRequired(KeyIndex, Shop_Item_Price)

            if (ShopItemConditional.HasAllItems[Player]):
                ShopItemConditional.Activate(Player)
                ShopItemGranter.GrantItem(Player)

I found a way to solve this.

Solved: No Need to Pass the Index!
I was trying to pass an ItemIndex parameter to determine which item to purchase, but I couldn’t get it to work. Instead of forcing the index, I found a better solution: removing the need for it entirely.

Solution:
Instead of passing an index, I store the necessary item data inside an instance of my ItemPurchase class. Now, when the purchase function is called, it already knows which item to process.

How I Fixed It:
:one: Create an instance of ItemPurchase with the item data:
ItemPurchaseInstance := ItemPurchase{Item_Data := Item, ItemConditional := ItemConditional}

:two: Subscribe the ItemPurchase function to the button click event:
PurchaseButton.OnClick().Subscribe(ItemPurchaseInstance.Purchase)

:three: Modify the Purchase method to work without an index:

ItemPurchase := class:
    Item_Data : ItemData
    ItemConditional : conditional_button_device

    Purchase(Message: widget_message) : void =
        Player := Message.Player
        Item_Price := Item_Data.ItemPrice
        KeyIndex := 0
        ItemConditional.SetItemCountRequired(KeyIndex, Item_Price)

        if (ItemConditional.HasAllItems[Player]):
            Print("Purchase Item!\nPrice = {Item_Price}")
            ItemConditional.Activate(Player)
            Item_Data.ItemGranter.GrantItem(Player)
        else:
            Print("Unable to Purchase Item!\nPrice = {Item_Price}")

Why This Works?
:white_check_mark: No need to pass an index—each instance already knows which item it handles.
:white_check_mark: The code is simpler and easier to maintain.
:white_check_mark: The purchase function works directly without extra parameters.

Hope this helps others facing the same issue!