that is my widget code pls if you know how to fix it help me, I would really appreciate it.
Hi,
If the actor that is referenced or has this function is destroyed, then it won’t work.
Hey @ILECTRODUDE. It is as @Polysiens says. You probably just need to get a new reference of the Character once it respawns.
Make sure to reset stamina upon death
can you help me because im new and i still barely understand blueprints.
Hey there @ILECTRODUDE! So it depends how your deaths are handled. If you aren’t destroying the player outright and respawning it, you should be able to keep the reference to the widget active. Are you creating a new UI when the player respawns?
Hi @SupportiveEntity . my death and respawning system is by destroying the actor.
The error message is this: Blueprint Runtime Error: “Attempted to access BP_FirstPersonCharacter_C_0 via property char ref, but BP_FirstPersonCharacter_C_0 is not valid (pending kill or garbage)”. Node: Return Node Graph: GetPercent_0 Function: Get Percent 0 Blueprint: staminawidget .
this is the code for the stamina widget.
No problem @ILECTRODUDE! So this is a bit of a multitiered answer that does depend on how you spawn the UI since I know you destroy the player character entirely.
Do you spawn a new widget when the new player spawns or are you still using the old one?
If a new one spawns, was the old one properly destroyed? It’s possible your character creates a new one and that one is actually set correctly after respawn, but the old one was never removed from the viewport, thus can’t update it’s char ref, because it only updates on construct.
The alternative is that if you are using the same UI (maybe there is a check to see if one is made already or something of that nature), you’d then just have to make a new event to do the same thing your construct is doing now and call it whenever the player respawns.