What is the best way to make a Currency Label

the loop is useless in here you can just put an event to check whenever the Value is Changed
here’s how to do it

local player = game.Players.LocalPlayer
local YourCurrency = player.leaderstats.Coins
local YourTextLabel = script.Parent
YourCurrency.Changed:Connect(function(val)
YourTextLabel.Text = val
end)
1 Like

The suggestions above are basic and okay, however if you want / need abbreviations, you should make a function which abbreivates the number accordingly.

how do you do the abbrevs in them like?

I assume you mean add a money sign.

“$”…val

i think he means like “k” or “M”

1 Like

yup, here’s what @Valkyrop meant.
Number Abbreviation

2 Likes

ok, I would suggest going with a Gui simular to this
New Project

heres what my script would look like

while wait(1) do
	script.Parent.Text = '$ '..game.Players.LocalPlayer.leaderstats.Cash.Value  -- Don't worry about what the text says just change 'Cash - ' to the name of your stat
end
1 Like

as i mentioned above, using a while loop in this is useless .Changed Event will do the job.

i think this will work for now until ive found something that will cover
some short abbrevs Thank you

i cant use this! it doesn’t show my stat when i load

you must change YourCurrency to your own currency.

but it Does work, @ayoub50’s is another good example

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