NEED A LITTLE HELP WITH BOLT PLEASE

Dear Friends, I’m Mauro from Rome, I need your help. I’m building a fitness app and I need to bolt a function that subtracts a point from the health bar every ten seconds. I created this flow machine where if you come into contact with some objects it adds points to the health bar. However, the part that subtracts a point every ten seconds (I enclose the “offending” part does not work, after ten seconds it subtracts a point and then reset the health bar (discharges to zero instead of decreasing 99, 98, etc. every ten seconds). What am I wrong? Can you help me? Thank you so much

Mauro from Rome

8140625--1056779--Bolt Issue.png

First, I don’t think it’s a good idea to put a Wait into your Update like that. You should instead do it one of two ways, trigger an event at Start that keeps itself running (a custom event that starts with a wait and ends with triggering itself), or use a variable to count time passed, and trigger the script when that goes over 10s (and reset the variable at the same time).

The reason your graph is working the way it does is because every time your project draws a frame it calls that update function, which waits 10s and then calls the script. So, after the first ten seconds it will execute your script every frame.