I'm trying to make a script where the Number value never goes negative but stays on 0 instead of something like -16.-
The maximum of 0
and a number x
will be 0
if x
is less than 0
, and otherwise it will be x
.
Lua implements maximum as math.max
:
x = math.max(x, 0)
0 -> 0 1 -> 1 5.9 -> 5.9 -5 -> 0 -0.01 -> 0
Please can you post the script or explain to problem a bit further.