C++ Ammo works, but doesnt show on screen?

I created C++ ammo counter, which basically lets the player shoot only 30 times(like a magazine), I was trying to add the player ammo with the UI Widgets, however, I get 0 when I press play.
P.S The ammo stop system works, it does let the player only shoot 30 bullets, and it doesn’t matter if he does it in full auto or by pressing a lot of times. The problem I have that the UI Widget shows 0 all the time doesn’t update how much the player has ammo or used.
Ammo system is in Weapon class, so in UI widget I cant cast it to BP_Player(Character blueprint)

Screenshots:

239908-c-mag.png

Can you be more specific? as I’m really new to blueprints. :smiley: so Get Owning Player Pawn doesn’t set the owning player?

It doesn’t look like you’re setting the owning player when you create the ammo widget.

didn’t work :confused:

I tried this, however, it shows an error that self isn’t a widget and from that point I cant “Get” anything else. So I think the problem is c++ code.

in your third screenshot there’s a blank node: OwningPlayer. You should set it to your pawn to get GetOwningPlayerPawn() working

could you show me the current setup?