https://developer.roblox.com/en-us/api-reference/lua-docs/math.
--According with what i tested, all it does is this: print(math.clamp(1,4,10)) --If the number 1 is lower than 4, it will return 4. If it is 5, though, it will return 5. But, if its over 10, it will return 10. --All it does, is this: function clamp(x,min,max) if x < min then return min end if x => min and x <= max then return x end if x > max then return max end end
Math.clamp takes 3 values. X, min, and max. If X is in the range between min and max it returns X. If X is lower than min it returns min and if X is higher than max it returns max. This can be useful for tons of applications, but a good example would be constraining rotation on an axis. If you want a player to control the rotation of a brick on the Y-axis but only in a 90-degree window you could clamp its total rotation.
Example:
math.clamp(x, y, z)
x is the value you want to clamp
y is the minimum value x can be
y is the maximum value x can be
math.clamp(5,1,6) returns 5 math.clamp(0,1,6) returns 1 math.clamp(7,1,6) returns 6