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

Changing The Text Label As The Leaderboard's Value Changes?

I want that when the player buys a thing and his money get deducted at the time it gets deducted I want the text label to show his money as it get deducted but my script dosent it keeps the value as it was the first time the player joined it dosent work can someone help me?

local Money = script.Parent.Menu.Money
local plr = game.Players.LocalPlayer
local Gold = plr.leaderstats.Gold.Value
Gold.Changed:Connect(function()
	Money.Text = "Gold: "..Gold
end)

1 comment

0

What you're doing wrong is your [[Gold]] variable. You are actually saving the current Value of Gold. You should instead set the variable to the path to your Gold. Then when you use your variable you write Gold.Value

1 answer

✓ Accepted answer

You can use the GetPropertyChangedSygnal() function for it. Here you go:

local Money = script.Parent.Menu.Money
local plr = game.Players.LocalPlayer
local Gold = plr.leaderstats.Gold
Gold:GetPropertyChangedSygnal("Value"):Connect(function()
    Money.Text = "Gold: "..tostring(Gold.Value)
end)

2 comments

0

This is a solution, a good one, but you should also announce the asker to what they did wrong.

0

thx

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