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

Leaderstat gui not working after a player resets?

Asked by 5 years ago

I made a Profile Gui which allows players to veiw their stats (Levels, Exp, Coins, etc,) and I made this script:

local cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats:WaitForChild("Coins")

function changed()
    script.Parent.Text = "Coins: "..cash.Value
end

cash.Changed:connect(changed)


Everything worked fine in studio and in game. I tested it out with a couple of my friends and it was all working for them. But once we all reset the script no longer showed the stats. Is there something I did wrong? (The script above is for the Coins Stat.)

0
The script is in a TextLabel in the Profile Gui if that helps at all! tawk1215 47 — 5y

1 answer

Log in to vote
2
Answered by
herrtt 387 Moderation Voter
5 years ago

There you go, this version will work. Just change the location of the textlabel.

local plr = game.Players.LocalPlayer
local cash = plr.leaderstats:WaitForChild("Cash")
local textLabel = idkwherethetextlabelis

textLabel.Text = "Coins: "..cash.Value

cash.Changed:Connect(function()
    textLabel.Text = "Coins: "..cash.Value
end)
Ad

Answer this question