GUI not showing leaderstat values

Currently I’m working on a GUI that displays the Local Player’s username and Points Leaderstat value. When I change a leaderstat value via the console, the GUI TextLabel does not update. Does anyone know what is causing this issue and how it could be resolved?

The leaderboard: (After setting points value from 100 - 72495)
image

The GUI: (After setting points value from 100 - 72495)
image

The script: (Local Script within a TextLabel)

local pointsValue = player.leaderstats.Points.Value

script.Parent.Text = pointsValue.." Points"

you have to do
pointsValue.Changed:Connect(function(newval)
– run your code here
end)

Getting this error in the output (Client-Side):

The Script:

local player = game.Players.LocalPlayer
local pointsValue = player.leaderstats.Points.Value

script.Parent.Text = pointsValue.." Points"

pointsValue.Changed:Connect(function(newval)
	script.Parent.Text = pointsValue.." Points"
end)

yea, just do
player.leaderstats.Points.Changed

Changed is for any property under an instance. Make sure it’s just the instance, not a property. If you want to monitor a specific property, I recommend:
GetPropertyChangedSignal()
Example

game.workspace.part1:GetPropertyChangedSignal("Size"):Connect(function(change)
   print(change) --Prints size.
end)

Try connecting a Changed event or adding while loop.

local pointsValue = player.leaderstats.Points
script.Parent.Text = pointsValue.Value .." Points"

pointsValue.Changed:Connect(function()
	script.Parent.Text = pointsValue.Value .." Points"
end)
1 Like

Couldn’t you just do a while loop (with a wait) and change the text everytime it runs?

local pointsValue = player.leaderstats.Points.Value

while wait(1) do ——change wait to whatever you want.
script.Parent.Text = pointsValue.." Points"
end

Please let me know if my way of doing this is incorrect or using a bad practice.

Also are you changing the values on the client or server? If your doing it on the client, it’s not updating to the server, therefore the points won’t update as it reads what the server says it’s value is.

Found something that will work:

local player = game.Players.LocalPlayer

local pointsValue = player.leaderstats.Points

script.Parent.Text = "Points: "..pointsValue.Value

pointsValue.Changed:Connect(function()

script.Parent.Text = "Points: "..pointsValue.Value
end)

You can change the way the text goes for points.

1 Like
while wait() do
local pointsValue = player.leaderstats.Points.Value
script.Parent.Text = pointsValue.." Points"
end
player.leaderstats.Points:GetPropertyChangedSignal("Value"):Connect(function)
   textlabel.Text = player.leaderstats.Points.Value
end)

Thank you, this worked! I’ve also taken your suggestion to have the word ‘Points’ before the actual number. Thanks for your help!

No problem! I am so happy to help!

1 Like