-- Energy
local Player = script.Parent.Parent.Parent.Parent.Parent
local abbreviatedNumber = Player.Energy.Value
local abbreviations = {
K = 4,
M = 7,
B = 10,
T = 13,
Qa = 16,
Qi = 19,
Sx = 22,
Sp = 25,
Oc = 28,
N = 31,
D = 34,
Duo = 37,
Tre = 40
}
local text1 = tostring(math.floor(abbreviatedNumber))
local chosenAbbreviation
for abbreviation, digits in pairs(abbreviations) do
if #text1 >= digits and #text1 < (digits + 3) then
chosenAbbreviation = abbreviation
break
end
end
if chosenAbbreviation then
local digits = abbreviations[chosenAbbreviation]
local rounded = math.floor(abbreviatedNumber / 10 ^ (digits - 2)) * 10 ^ (digits - 2)
text1 = string.format("%.1f", rounded / 10 ^ (digits - 1)) .. chosenAbbreviation
else
text1 = abbreviatedNumber
end
-- Strength
local Player = script.Parent.Parent.Parent.Parent.Parent
local abbreviatedNumber = Player.leaderstats.Strength.Value
local abbreviations = {
K = 4,
M = 7,
B = 10,
T = 13,
Qa = 16,
Qi = 19,
Sx = 22,
Sp = 25,
Oc = 28,
N = 31,
D = 34,
Duo = 37,
Tre = 40
}
local text2 = tostring(math.floor(abbreviatedNumber))
local chosenAbbreviation
for abbreviation, digits in pairs(abbreviations) do
if #text2 >= digits and #text2 < (digits + 3) then
chosenAbbreviation = abbreviation
break
end
end
if chosenAbbreviation then
local digits = abbreviations[chosenAbbreviation]
local rounded = math.floor(abbreviatedNumber / 10 ^ (digits - 2)) * 10 ^ (digits - 2)
text2 = string.format("%.1f", rounded / 10 ^ (digits - 1)) .. chosenAbbreviation
else
text2 = abbreviatedNumber
end
local Strength = Player.leaderstats.Strength
script.Parent.Text = text2.."/"..text1
Strength.Changed:Connect(function()
script.Parent.Text = text2.."/"..text1
end)
COMMUNITY QUESTION
How to fix a Live Currency BackPack Script?
1 answer
ummm... if you're using a local script, make sure to just define player like
local Player = game.Players.LocalPlayer
and to make it a "live" count, just use Loop to keep checking the player's stat and make the number that.
How to use loops: https://developer.roblox.com/en-us/articles/Roblox-Coding-Basics-Loops
6 comments
0
It's not working!
0
Wait. Hold on actually!
0
deosn't work
0
which part doesn't work?
0
just keep looping the part where it tells you what the player's strength is
0
I don't get what your saying just in the pictures i put for comments i want strength to match up in the ui while like in backpack so when i click it goes 1/inf 2/inf 3/inf and so on
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
https://pasteboard.co/IN6YOFv.png
https://pasteboard.co/IN6Yugp.png
Marked as non-descriptive as the OP doesn't know what causes a bug nor has done any debugging