Timer Breaks when I respawn

Hi
I am making a game where you have to get to the finish line before the timer runs out.
I made a respawn point, but when I respawn my timer breaks when I use destroy actor I think but i don’t know how to fix it.Video

Here is the code of the Timer, it is inside my first person character BP

And the Timer in the UI code

What is calling tick2?

It is just an extension of the original tick, so i don’t have to pull out lines out the main tick

Ok, then the delay does nothing :slight_smile:

If the counter is in your character, and you’re killing and respawning, then either you need to restart the counter, or put the counter outside the character.

You could put the timer in the game instance.

This code would work much better

You only need to call it ONCE :wink:

2 Likes

Thank You for the help, I will try to put in a game instance I will let you know if it works :slight_smile:

1 Like

No worries. You might also find timer nodes interesting :slight_smile:

image

1 Like

So I put the Time code into a game instance like so.

then I put the custom events in an actor blueprint, so I can set the time individual by level

But all I get to see is the dead screen when I try to test it out

Did you initialize the timer to 5 mins?

The other possibility, is you didn’t specify your game instance in the project settings.

Apart from that, it looks fine :slight_smile:

1 Like

How do I do that, specify your game instance in the project settings?

1 Like

I have added to my maps class

but i get this huge error and the timer is still not working, I have looked up the error but have no idea what the problem is

if I click on the error, it sends me to the UI where I store the numbers for the timer

I have no idea what the error is :frowning:

Yeah, but the widget also needs to get the info from the game instance, right? :wink:

Because that’s where it is now, it’s not in the player anymore…

In the widget

and

Etc… :slight_smile:

2 Likes

Yes, it works, thank you for taking the time to help me!

I have one issue and that is when the time is over and the dead screen comes, the player can still move. I tried different things like calling the player movement to stop in the game instance now I tried it in the actor Timer blueprint


You need to do a ‘get player controller’ and plug it in here

You like this you mean?


Because that is still not working. Also used this setup like it was shown in the Video

image

1 Like

Yes that worked! And again thank you for the help :slight_smile:

1 Like