Hi I was wondering if you could display the stats on the leaderboard in a textlabel. For example you have 4000 points in your balance. Can you please help me with this?
Showing leaderboard stats?
2 answers
When you have leaderstats, the layout should look like this:
Players
Player
leaderstats
Points
A TextLabel in a ScreenGui can easily access these stats using a LocalScript.
game.Players.LocalPlayer.leaderstats.Points.Changed:connect(function() --This checks if the "Points" stat changed.
script.Parent.Text = game.Players.LocalPlayer.leaderstats.Points.Value
end)
6 comments
That didn't work in a local script...
I might have the script wrong. Is the LocalScript in the TextLabel and did you change "Points" to the stat's name?
yes
That's odd, it works perfectly fine when I test it. What does output say?
Don't use while true do like that, it's horribly inefficient. Use events, like Changed.
My bad, thanks for pointing that out! I edited my answer.
If you are trying to show your stats, you would do this.
P = game.Players.LocalPlayer
script.Parent.Text = "Points: "..P.leaderstats.Points.Value
end
Just insert this script directly into your local script located in the text label. And if you arent using leaderstats for a stat holder, change the name to whatever holder you are using.
2 comments
Why is there an end?
If scripts like this dont have an end it shows the red line under it.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Of course You can. Its a pretty easy method.