Very oofed im trying to make a gui that shows your cash but i cant seem to do it. my script:
01 | local suffixes = { '' , 'K+' , 'M+' , 'B+' , 'T+' , 'Qd+' , 'Qn+' , 'S+' , 'Sp+' , 'O+' , 'N+' , 'D+' } |
02 | local function format(val) |
03 | for i = 1 , #suffixes do |
04 | if tonumber (val) < 10 ^(i* 3 ) then |
05 | return math.floor(val/(( 10 ^((i- 1 )* 3 ))/ 100 ))/( 100 )..suffixes [ i ] |
06 | end |
07 | end |
08 | end |
09 |
10 |
11 | local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() |
12 | local leaderboard = player:WaitForChild( "leaderstats" ) |
13 | local Stats = leaderboard.Coins |
14 | local value = script.Parent |
15 |
16 | script.Parent.Text = format(Stats.Value)script.Parent.Parent.Parent.ValName.Text = "Cash" |
17 |
18 | Stats:GetPropertyChangedSignal( "Value" ):Connect( function () |
19 | script.Parent.Text = format(Stats.Value) |
20 | end ) |
i suspect its the suffixes that is bugged
Add a GUI and put this LocalScript inside of the TextLabel
01 | wait( 1 ); |
02 | local u 1 = { "" , "K" , "M" , "B" , "T" , "Qd" , "Qn" , "Sx" , "Sp" , "Oc" , "N" , "De" , "UDe" , "DDe" , "TDe" , "QdDe" , "QnDe" , "SxDe" , "SpDe" , "OcDe" , "NvDe" , "Vgn" , "UVg" , "DVg" , "TVg" , "qtV" , "QnV" , "SeV" , "SPG" , "OVG" , "NVG" , "TGN" , "UTG" , "DTG" , "tsTG" , "qtTG" , "QnTG" , "ssTG" , "SpTG" , "OcTG" , "NoAG" , "UnAG" , "DuAG" , "TeAG" , "QdAG" , "QnAG" , "SxAG" , "SpAG" , "OcAG" , "NvAG" , "CT" } ; |
03 | local function v 1 (p 1 ) |
04 | for v 2 = 1 , #u 1 do |
05 | if tonumber (p 1 ) < 10 ^ (v 2 * 3 ) then |
06 | return math.floor(p 1 / ( 10 ^ ((v 2 - 1 ) * 3 ) / 100 )) / 100 .. u 1 [ v 2 ] ; |
07 | end ; |
08 | end ; |
09 | end ; |
10 | local l__LocalPlayer__ 3 = game.Players.LocalPlayer; |
11 | while wait( 0.01 ) do |
12 | script.Parent.Text = v 1 (l__LocalPlayer__ 3 :WaitForChild( "leaderstats" ):WaitForChild( "Cash" ).Value); |
13 | end ; |
Well if you're just trying to make a UI that shows the value "Cash" here's how to do it.
LEADERSTAT SCRIPT:
1 | game.Players.PlayerAdded:Connect( function (player) |
2 |
3 | local leaderstats = Instance.new( "Folder" ,player) |
4 | leaderstats.Name = "leaderstats" |
5 | leaderstats.Parent = player |
6 |
7 | local cash = Instance.new( "IntValue" , leaderstats) |
8 | cash.Name = "Cash" |
9 | cash.Value = 10 ---- Change value if you want |
=========================================================================
1 | -- Insert Gui in StarterGui and add a textlabel. |
2 | -- Move textlabel anywhere and then edit it how you like. |
3 | -- Add a localscript in the textlabel and copy and paste the lines of code below into the script |
4 | while wait() do |
5 | local player = game.Players.LocalPlayer |
6 | script.Parent.Text = "Cash: " ..player:WaitForChild( "leaderstats" ):FindFirstChild( "Cash" ).Value |
7 | end |