I made a punching simulator UI and when the number goes over 1 000, 1 000 000 or more it adds zeros or "XXe + XX", I want to have shortcuts for the numbers like:
1 000 = k - thousand
1 000 000 = M - milion
1 000 000 000 = B - Bilion
1 000 000 000 000 = T - Trillion
1 000 000 000 000 000 = Qa - Quadrillion
and so on, This is my UI and my script, How can I do that the letters will display in the Strenght (Power) UI?
#Help with Adding shortcuts for numbers in UI
14 messages · Page 1 of 1 (latest)
That’s a little more complicated than it seems but you could int divide the value, then use table indexes to add a suffix
There’s also a dev made module
Forgot the name
i tried this script and it worked:
local player = game.Players.LocalPlayer
-- Funkcia na formátovanie ÄŤĂsiel s prĂponami
local function formatNumber(value)
local absValue = math.abs(value)
if absValue >= 1e15 then
return string.format("%.2fQa", value / 1e15)
elseif absValue >= 1e12 then
return string.format("%.2fT", value / 1e12)
elseif absValue >= 1e9 then
return string.format("%.2fB", value / 1e9)
elseif absValue >= 1e6 then
return string.format("%.2fM", value / 1e6)
elseif absValue >= 1e3 then
return string.format("%.2fK", value / 1e3)
else
return tostring(value)
end
end
while wait() do
local powerValue = player.leaderstats.Power.Value
script.Parent.TextLabel.Text = formatNumber(powerValue)
end
** You are now Level 1! **
Developer Forum | Roblox
Hello! I was looking for a script that shorten numbers, but they do not work.I do not understand how to make this system, but I think that the system should be in this script. I have a local script that gives points. local Point = Instance.new("IntValue") Point.Name ="Point" Point.Value = 0 Point.Parent = script.Parent script.Parent.MouseMove...
Oh alr then
It’s annoying to make changes with higher numbers