Hello! i’ve been workin on sometin and i need help with IntValue/NumberValue i want to add Text Besides it for Example
Here
instead of 100,000 i want to add “K” so it will be : “100K” i dont think StringValue will help me with changing Value as Int or NumberValue
if it was on text label i’d do
--// First insert Local Script inside TextLabel
local T1 = script.Parent --// here will be Text u changing
local T2 = script.Parent.StringValue --// make sure that String.Value is K
local T3 = script.Parent.IntValue --// put here 100 or any number u want
while wait() do
T1.Text = T3.Value..(T2.Value)
end
Here’s the Results of that code
if u have any Solution, leave a Post on this or Content me with Messages On Devforum or throw discord dms: xStaRz2🖤#1162
Can’t, it has to be a StringValue. The leaderboard should only be used for display, not as your actual data set. Store the real data value elsewhere and use the leaderboard to show the cash count with an abbreviation. Ways to abbreviate the number are available around the DevForum if you search it up.
What your looking for is number abbreviations right?, you could probably search this up and probably should (as it’s a good practice) but here is an example of how you can abbreviate numbers :
function Abbreviate(N,Sign , Decimals, Ab) --N is the number, sign any string after our number,Decimals are the amount of zero before the decimal, Ab is the Abbreviations
if Ab == nil then
Ab = { ---- Abbreviations
K = 4,
M = 7,
B = 10,
Qa = 13,
}
end
local text = tostring(math.floor(N))
local CurrentAb
for A, D in pairs(Ab) do
if A then
if #text >= D and #text < (D + 3) then
CurrentAb = A
break
end
end
end
if CurrentAb then
local digits = Ab[CurrentAb]
local rounded = math.floor(N/ 10 ^ (digits -2 )) * 10 ^ (digits -2)
if Decimals then
text = Sign..string.format("%."..Decimals.."f" , rounded/10 ^(digits -1) )..CurrentAb
else
text = Sign..string.format("%.0f", rounded/10 ^(digits -1) )..CurrentAb
end
else
text = Sign..N
end
return text
end
print(Abbreviate(5451, "", 0)) -- this would print 55K, because there are no zeros
print(Abbreviate(5451, "", 1)) -- this would print 54.5K
This is where you can find the tutorial on this (i changed it a little but it’s similar):