The issue is not really solvable while keeping it a number, since that’s being caused by a floating point error, but what you could do, is do something like
local Stringnum = string.sub(tostring(math.round(number*10)/10), 1, 4)
so it’s rounding to the nearest 1 decimal, then, converting it into a string, and finally gets the first 4 characters of the string(so it’s limited to 4 total digits)
Okay not a problem. I’ll outline explicitly how this would work for your example and try to explain it in a bit more detail.
local MASH_MULTI_DISPLAY_FORMAT = "Mash Multiplier: %.3f > %.3f - ✨%.3f Gems✨"
local currentMulti = math.floor(game.Players.LocalPlayer.upgrades.MashMulti.Value)/10+1
local nextMulti = math.floor(game.Players.LocalPlayer.upgrades.MashMulti.Value)/10+1.1
local newGems = game.Players.LocalPlayer.upgrades.MashMulti.Value * 25 + 25
script.Parent.Text = string.format(
MASH_MULTI_DISPLAY_FORMAT,
currentMulti,
nextMulti,
newGems
)
So where I have written %.3f in the format string (MASH_MULTI_DISPLAY_FORMAT) will be where the numbers are placed. The .3f means 3 decimal places. There are more flags / options which are listed in the documentation.
You’ll get the hang of it more easily by trying it out yourself.
Yeah that is correct. The . signifies that it is decimal places. The 1 (or 3) specifies the number of places. The f means it expects a floating point number as an input.