ive done that but still nothing
it must work just fine, do you have any errors in the output?
Is you leaderstats script spelled Leaderstats
or leaderstats
?
because that makes a difference
if understand the .changed function you know that it only shows when the Cash value changes so when you first join nothing is being changed so it does not show on the label
you can just do
local player = game.Players.LocalPlayer
local YourCurrency = player.leaderstats.Coins
local YourTextLabel = script.Parent
YourTextLabel.Text = YourCurrency.Value
YourCurrency.Changed:Connect(function(val)
YourTextLabel.Text = val
end)
you are showing the same code nothing is showing WHEN i join
its not the same code.
the TextLabel will change once the player joins,
also ru using a localscript or a serverscript?
and do you have any errors?
oh sorry i didnt see the extra line
Did you try all of our suggestions?
Here is a working way:
local abbreviations = {
N = 10^30;
O = 10^27;
Sp = 10^24;
Sx = 10^21;
Qn = 10^18;
Qd = 10^15;
T = 10^12;
B = 10^9;
M = 10^6;
K = 10^3
}
--//Functions
local function formatNumber(n)
n = tostring(n)
return n:reverse():gsub("...","%0,",math.floor((#n-1)/3)):reverse()
end
local function abbreviateNums(number)
local abbreviatedNum = number
local abbreviationChosen = 0
for abbreviation, num in pairs(abbreviations) do
if number >= num and num > abbreviationChosen then
local shortNum = number / num
local intNum = math.floor(shortNum)
abbreviatedNum = tostring(intNum) .. abbreviation .. "+"
abbreviationChosen = num
end
end
return abbreviatedNum
end
--'Level' is your stat
if Level.Value < 100000 then --you could change this
LevelText.Text = formatNumber(Level.Value)
else
LevelText.Text = abbreviateNums(Level.Value)"
end
The first function would result you:
Say we have 50000 gold, it’d return 50,000
The second function would make it 50k
oh maybe you forgot to assign the player.
all these suggestions work thank you and instead of assigning just one as a solution ill say all of you are the solutions
(Post Deleted By Author Devforum)