Trying to change visibility of UMG widget

So what I’m trying to set up is an ammo/health counter for a FPS game within a HUD, except I want it to be an image instead of text. I’m very new to blueprints, no programming experience, so I’m not sure what I’m doing wrong. I have a function in my first person character blueprint that adds 1 to a variable called Health (which is set to 0) whenever I press F. Whenever “health” is at 1, I want the letter one (img 40) to appear on the viewport, and when it is not equal to 1, I want it to become invisible. For some reason my image is always visible and never changes whenever I hit F. Here is what I have so far. I’m pretty sure I’m missing an Exec wire to connect to my Branch node. I tried creating a binding for visibility on the image but I have no idea how that works. Any help greatly appreciated.

You can create binding for Image visibility by selecting your Image and in “Behavior” group under “Visibility” click “Bind” and “Create Binding”. This will create function for you where you can paste your logic.

I got it to work, thankfully! That took me hours. However I’m getting this error message below the Cast to First Person Character node and I have no idea what it means. Apparently I’m supposed to connect it to a return node, but it only let’s me connect it to one of them. Not sure what to do. Also thanks for the help.

Explaining your Blueprint graph, you are getting reference to the default Player Character (it is set in Game Mode), then casting to your class, getting Health value and comparing to “1”. If true, then you want to set image visible. If false, you want to set it hidden. You do not need to worry where to call binded function, because UE take care of it for you.

When you have function with return node, all execution paths need to be connected to at least one of them. It is up to you what functionality you want to achieve. Ask yourself: “What should happen when the Player Character is not a FirstPersonCharacter class but something else? Should the image be visible or not?”.

Fair enough, sounds like the best answer is the hidden node.