I have a custom health system in my game along with a custom health gui. The gui runs off how much health the numbervalue for the health has. Is there a way to set a minimum (and maximum if possible) for a number value, so the health can't go below 0, or above 100?
COMMUNITY QUESTION
How to make a minimum amount for a number value?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
ummm, i think you just have to detect for when the value changes, and use if statements to make sure it satisfies your needs.. can't think of any roblox integrated methods
You can probably use :GetPropertyChangedSignal("Value") and check if it's less than 0 (< 0), if it is, then set it back to 0. If it's greater than 100 (> 100), then set it back to 100.
math.clamp would be a good function ot use in this case.