Int Problem need help fast.

So i have a click event game you click the object flying towards you and it adds up how many you have with the hud. But for some reason it will not add for me. It goes from 0 to 1 then it just stays at 1. How can i get it to keep going past 1. In the level blueprint i have it set so i posess a camera when the game starts. so i’m not using the “MyCharacter” because you do no need to move. And i have all of this setup inside the blueprint of the static mesh that you click. Here is my blueprint. Can anyone help me fix this.

Add Score:


Score Hud:


In your top picture, you have your variable Score attached to an add node and a Set Score function. All you are doing is setting your Score back to your original Score value.

Instead, drag the Add result pin to your set, as well as your Present Count function.

i did that and now it jumps from 0 to 2 then does not go higher than 2.


Your attachment is broken.

It should be fixed. But it just shows where i moved the pin. But that way does not work either. I goes from 0 straight to 2 and does not go any further.

Ok i just hooked up a Event tick to the blueprint i posted above and it works fine with the event tick. But i dont want it to count up with the event tick. I want it to count up every time i finish the process i have before it. Does anyone know why it would work with the event tick and not with anything else.?

I still cannot get this to work does anyone know what the problem is.?

If you still have this hooked up the same as in your first post, you will need to connect it like this, otherwise it will never update the score in your HUD:


I tried that but its still not working. Ill post my full Bp and see if that helps.


Hi, after setting Score0 to (Score0 + 1) you’re actually passing (Score0 + 1) to the Score function instead the current value Score0. To fix that, link Score0 to the Score function, not Score0 + 1.


Clarification: Pure functions (those without incoming execution pin) are actually executed every time they are needed, thats why the add happens twice.

Ok That fixed that part but it still does not go any higher than 1. I starts at 0 then goes to 1 then never goes any higher. Do you know what could be causing that?

I wonder if the actor destroyed is the same or a new one. Because if this is a new one, then this is a new score which is 0. In case of this is the trouble, you’ll have to set score in level and use an evnt dispatcher to set score.

Didn’t even think of that. I setup a little test game just to make sure I wasn’t giving bad advice, as I am new to Blueprints myself. This works on my end. If I am not mistaken, wouldn’t it be best to keep things like the score in a Game Instance?


Ive never used “Game Instances” so i’m not sure how to use them. Can you explain what they do.?

Also i tried a event dispatcher and it did not work.



All i’m trying to do is take the Int (which starts at 0) and add + everytime the actor i click get destroyed. Then print that on the screen. I never thought this would take as long as it has.

I think i get it : Set your variable score in your hud and in your event do get player controller / get hud / get score / set score = score +1 / draw text, would work fine without more needd.

Yeah Fen’s way should work for you, but the reason for all the hassle is you are setting the value within one of the present’s blueprint (I’m assuming that’s what it is), since there are multiple blueprints all adding 1 to their initial score of 0, all of them return 1.

You need to set the score globally instead of inside the object. :slight_smile:

i’m not sure what you mean by “and in your event do get player controller / get hud / get score / set score = score +1 / draw text” What event do you mean.? The score function in the blueprint interface?

I’m still pretty new to blueprint. I did it that way because i wanted it to add after the object was destroyed. How else can i tell it to add when its destroyed if its not in that blueprint.?

I did it quickly :
Personaly, i would do the draw and then only destroy component / actor. File updated !

Thank you! I understand what you ment now. i never thought about casting to a Custom event but now i know. I guess i still have alot to learn.