I need some help on my shooting-system. My turret has unlimited ammo, but to prevent constant shooting I want to have a cooldown-effect that stops shooting, to simulate an overheated-effect of the turret. For visualization I have added a slider (Values 0-100)
In case one has the turret really overheated (Slider-value <= 10) one can not shoot anymore until the value reaches 75. I have written the code but is not working.
The second if will never be reached since you check if the value is less or equal than 10 before and if the expression is true, you check if the value is greater or equel to 75. The value can’t be <= 10 and >= 75 !
Just take the second if outside the first one like @OctoMan suggested.
By the way, getting the component like you do is a very bad idea. Prefere getting the component once in the start and use it in your function.