Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Leaderstat gui not working after a player resets?

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.)

1 comment

0

The script is in a TextLabel in the Profile Gui if that helps at all!

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.