Hi! I was following a tutorial for a stamina bar and the guy doesnt clear up a bug which is infinite stamina. A few people have said to include a branch with the condition <100 before the set stamina however this doesnt seem to fix the problem and wondered if anyone could help?
Hey @CatMathGames! Welcome to the forums!
We’d love to help, but we’ll need to see some code! There are a ton of ways this can be done, and even more ways to cause that bug but if you could get us some screenshots I’m sure we can take care of you in no time.
Im a huge newbie so appologies if i dont upload all the information! This is what the tutorial ran me through, I added in a < 100 branch at the end of the first image but it doesnt seem to be doing much in stopping the stamina ticking beyond 100. Thank you for the help!
Your condition in a Branch is basically testing if number 0 is less then 100 which is always the case. I imagine you want to check if the stamina is lower then 100. In that case you should plug in the stamina variable as the first argument in ‘<’ node.
That should stop the stamina from going over 100.
Not to discourage you from creating something but you might want to check out Timers and how they work. It can get resource expensive running everything on tick.
Keep it up!
Thank you for the feedback! i’ll 100% check out timers as ive seen a few people mention about ticks causing lag down the line, thank you for the help!
No problem, feel free to mention me when you encounter any future problems and I will gladly help you if I know how.
Cheers!