How to reset a variable after n time seconds?

Hi everyone,
basically I have to small problem. I have a player that whenever touch a specific object changes speed. Now, how can I reset his speed after seconds please?

1 Like

How about this?

mmhh I have partially solved the problem :slight_smile: but I got it

Perhaps a cleaner method is to use a retriggerable delay:

I found this out recently and it has made my graph much cleaner than using timers with handles :slight_smile:

Timers are more accurate than Delays in low fps situations. Meaning the event calling the Delay is frame reliant, whilst Timers have their own internal tick and loop. Thus @ClockworkOcean example will work “more accurately” in low FPS scenarios.

@Rev0verDrive this is good to know. I suppose I should rework these. But I noticed personally, neither delay or timers are much use in low-FPS situations :confused: .

You may never see a difference in your usage. How well timers and delays work depends on the efficiency and performance of the product.

There is a simple test that can be done to show some inaccuracy.

An event triggered by delay, 4 times per 0.016sec with max 10 fps lock will trigger 3 times.

An event triggered by timer, 4 times with a loop triggering each 0.016sec with max 10 fps lock will trigger 4 times.

The delay will lose 1 trigger event.