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?

3 comments

0

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

0

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.

0

math.clamp would be a good function ot use in this case.