Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do you make a gui connect to the leaderstats??

Asked by
Hafrew 16
4 years ago

****Very oofed im trying to make a gui that shows your cash but i cant seem to do it. my script:

01local suffixes = {'','K+','M+','B+','T+','Qd+','Qn+','S+','Sp+','O+','N+','D+','U+','Dd+','Td+','Qd+','Qnd+','Sd+','Spd+','Od+','Nd+','Vg+','Ug+','Dg+','Tv+','Qt+','Qv+','Sv+','Sg+','Ov+','Ng+','Tg+','Ut+','Dt+','Tt+','Qg+','Qtg+','Sg+','Spt+','Otg+','Nag+','Ung+','Dug+','Teg+','Qa+','Qn+','Sag+','Spa+','Oa+','Nv+','Ct+'}
02local 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
08end
09 
10 
11local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
12local leaderboard = player:WaitForChild("leaderstats")
13local Stats = leaderboard.Coins
14local value = script.Parent
15 
16script.Parent.Text = format(Stats.Value)script.Parent.Parent.Parent.ValName.Text = "Cash"
17 
18Stats:GetPropertyChangedSignal("Value"):Connect(function()
19    script.Parent.Text = format(Stats.Value)
20end)

it doesnt work idk why

Answer this question