Formating issue (?)

This.Value = math.clamp(tonumber((tostring(This.Value)):format('%.2f')), - Max, Max)

Not sure why, but I’m able to add more than two decimals, which shouldn’t be possible when using %.2f. Any ideas?

You’re supposed to put the formatting before calling the function:

('%.2f'):format(tostring(This.Value))

Although, I recommend you resort to this semantically better syntax, but it’s your choice:

string.format('%.2f', tostring(This.Value))

Well, that’s a dumb mistake, I even checked this, but somehow I mixed them up after my second test as I quickly wrote another line, otherwise it would work the first time.

Thank you for noticing.

I also noticed that 999 999.99 turns into 100 000 for some reason, completely ignoring the decimals.
The second thing I noticed is that the decimal is not showing up unless there’s a decimal to display, what would be the best way to always show the decimals, even if it’s .00?