Well, like I said in the title, the character dies as he is supposed to, when I go to an instadeath zone, and the respawn widget appears as it should, the issue is that it spawns before I press respawn and I am not sure what the issue is.
Hello @Alexs-GR7 ,
From what can be seen, you are calling Destroy Actor too many times. In my opinion, it should only be executed when the character actually dies; for example, when it collides with something, when its health reaches 0, or when a specific key is pressed (as shown in the following examples).
After that, you should use the Bind Event On Destroyed event. This is different from your approach, where you used On Player Died. Keep in mind that Bind Event On Destroyed is automatically triggered when the actor has already been destroyed, so there is no need to destroy it again from there.
I’ve made a few corrections to your Blueprint so it behaves the way you want. The player respawn logic is well implemented, so that part remains unchanged.
Thank for your response mate! I found the problem and it was that I called respawn Player function twice by mistake, while it should have been called only in the widget after I clicked Respawn, I also called it in the game mode in the end.
@Forum Moderators I still cannot select an answer as the solution!
@BRGEzedeRocco Hello mate! I wanted to ask another question about the issue above :D.
So I have slightly changed the code and used also a debug button. The main change is that in SetCollisionEnabled I set No collision this time. While using the debug button to die, everything is ok, the widget spawns, I press respawn, I do respawn and the widget disappears. If I die, but falling into a trap, I fall of the map, but I respawn with no issue after I press the button and the widget disappears, which is what I want. Before, I had something like query and physics on collision set, which didn’t let my character fall of the map, but also didn’t let for some reason my widget to disappear on 95% of the cases.