Help adding a damage and death system with 3 lives

I’m currently a first year uni student doing games design and I have a project where I need to make a marble game which needs to include 3 lives and a damage system. I’ve watched this YouTube tutorial https://youtu.be/EUqeN_m5yks?si=6xzLSCEVi24JqdRH where it creates the UI for the lives but I haven’t been able to find any video for a 3 lives damage system they’re all just health bars. Im wondering if anyone can help me out with the blueprint code or point me to a video where it can explain this stuff to me.

I’ve currently got a system in place where if the player’s marble rolls of the map there is a death screen so if possible I want it so when the player looses all lives they get taken to the same screen. I watched this video for it https://www.youtube.com/watch?v=LrExuqVQDb4 .

Hey @K4leundersea! Welcome to the forums!

Can you show us the code that you currently are working with? Generally, for lives, you’d store that as an Integer variable in the Game Instance, with a default value of 3. Then on your Widget you’d use the “Bind” function on whatever text box you’re using for the life tracking. Then you’d use “Get GameInstance”, cast to your game instance, and then get that integer variable to bind to it.

To reduce it “Get GameInstance” and casting to it would be added to the player’s death code, reducing your Integer by 1 and if it’s <0 you’d Open Level → whatever level you want, Main Menu etc. :slight_smile:

Hello, thank you for the welcome. This is the code ive currently got for the damage system, im currently in the middle of trying another tutorial but it’s not working so i might restart.

And this is the code i have for my UI