Blueprint Score

Help with updating score on collision.

  1. Ball with collision
  2. Goal trigger
  3. Text Render (In scene)
  4. variable “Points”

I need help writing a blueprint that updates the Text render with “Points”.

Thanks… Been trying nothing is working.

Hello Andre Jones.
You need three blueprints to get this working.
1: Your UMG widget.
you set your text Custom Event with an integer output.
And you call this Event every time your ball enters the goal.

2: Your pawn.
Add the Widget to your screen.

3: Your GoalTrigger.
First cast to your pawn.
Add an Box collision or any other collision object.
Change the collision presets to Trigger.
Then you can add the OnComponentBeginOverlap.
Check if it is your ball and not a other object.
Call the Event AddPoints.

Hope this will help you if you have questions about this feel free to ask :slight_smile:

Use a cast or ‘contains’ instead of equal to, as the name will not be just Ball. Display name should also never be used to identify things. Also, be sure to actually set the value of points in the event.

I know they’re minor things but sometimes the smallest things can get you caught up. Otherwise, great post.

Is an cast not more performance heavy then an equal to? and display name was example but you can also tag or something.
And I see that i forgot to set the points variable in the UMG. Thanks for pointing it out :slight_smile:

I made a post in answer hub on what I did for multiplayer game.

Use gamestate to hold your int for score. On overlap cast to game state to +1 to goal. Use the umg on player to cast to get state to then change the umg to a local umg variable to display.

Oh, sure. But equals is not the right string function (Contains is better), and display name is not the right ID. Either way, casting isn’t going to be so much of a performance hit that it would matter.