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 6 years ago

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

1local cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats:WaitForChild("Coins")
2 
3function changed()
4    script.Parent.Text = "Coins: "..cash.Value
5end
6 
7cash.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 — 6y

1 answer

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

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

1local plr = game.Players.LocalPlayer
2local cash = plr.leaderstats:WaitForChild("Cash")
3local textLabel = idkwherethetextlabelis
4 
5textLabel.Text = "Coins: "..cash.Value
6 
7cash.Changed:Connect(function()
8    textLabel.Text = "Coins: "..cash.Value
9end)
Ad

Answer this question