Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Showing leaderboard stats?

Asked by 9 years ago

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?

0
Of course You can. Its a pretty easy method. attackonkyojin 135 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

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)
0
That didn't work in a local script... docrobloxman52 407 — 9y
0
I might have the script wrong. Is the LocalScript in the TextLabel and did you change "Points" to the stat's name? IcyArticunoX 355 — 9y
0
yes docrobloxman52 407 — 9y
0
That's odd, it works perfectly fine when I test it. What does output say? IcyArticunoX 355 — 9y
View all comments (2 more)
0
Don't use while true do like that, it's horribly inefficient. Use events, like Changed. Perci1 4988 — 9y
0
My bad, thanks for pointing that out! I edited my answer. IcyArticunoX 355 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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.

0
Why is there an end? EzraNehemiah_TF2 3552 — 9y
0
If scripts like this dont have an end it shows the red line under it. attackonkyojin 135 — 9y

Answer this question