Calling a Widget Class Function on Spawn?

Hi all! I’m a bit stuck and need some help. I’m creating pong using this https://www.youtube.com/watch?v=Vi4tBmv1Mhg tutorial and I’m going off-script a bit to enhance my version. When player 1 scores, I want the ball to start heading in their direction. And when player 2 scores, I want the ball to head in the AI’s direction. The player who last scored is held in a variable owned by my Scoreboard Widget W_Scoreboard called Player1ScoredLast?.

When my ball spawns, it determines its direction of movement using the blueprint below. However it’s returning an error that the reference to the scoreboard doesn’t exist. I know why but I don’t know how to fix it.

When the ball spawns in, it needs to set its reference to the W_Scoreboard Widget Class, but if I understand correctly how this works, it’s the Scoreboard that needs to set the reference, not the ball. You can see an example of the reverse in the highlighted portion of the blueprint above. When the ball spawns in, it sets itself as a reference for the AIPaddle so the paddle can track the ball’s location.

I don’t understand the best practice though for accessing the scoreboard’s variable values when the ball spawns. I thought the answer might be to CastToWidget or CastToWidgetClass but the former requires the ball to have a reference to the widget. And the latter doesn’t seem to let me invoke a function within W_Scoreboard. Could someone advise please? Thanks!

where are you creating the widget? player character bp? player controller bp? create it in one of those and then create a variable from it inside that bp, then you can cast to that and access the widget that way, for example: create widget in player controller > promote to variable (player controller now holds the widget variable) > in the ball bp, cast to the player controller (yours not the generic one) and then you can call the widget reference from there.