Ad
Log in to vote
0

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

Asked by
Hafrew 13
11 days ago

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

local 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+'}
local function format(val)
    for i=1, #suffixes do
        if tonumber(val) < 10^(i*3) then
            return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]
        end
    end
end


local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local leaderboard = player:WaitForChild("leaderstats")
local Stats = leaderboard.Coins
local value = script.Parent

script.Parent.Text = format(Stats.Value)script.Parent.Parent.Parent.ValName.Text = "Cash"

Stats:GetPropertyChangedSignal("Value"):Connect(function()
    script.Parent.Text = format(Stats.Value)
end)

it doesnt work idk why

Answer this question