(Solved) UI | OnClick cannot be subscribed to a Player?

Hi Axel,
I haven’t played around with it on my side yet, but looking at the UI API, inside Fortnite.digest.verse and EpicGames.digest.verse:

  • text_button_base.OnClick can Subscribe a function that receives a widget_message.
  • widget_message is defined as
widget_message<native><public> := struct:
            Player<native><public>:player
            Source<native><public>:widget

This means you should be able to use the Player reference to the player that clicked the button for further processing.

ButtonTest:button_regular = button_regular{DefaultText:="ClickMe"}

OnButtonClicked(Message:widget_message):void=
        # Operate on Message.Player

OnBegin<override>()<suspends>:void=
        ButtonTest.OnClick.Subscribe(OnButtonClicked)
3 Likes