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

How do I modify the text of a TextLabel based on a Leaderboard stat?

Asked by 6 years ago

I have a tool called 'Quantum Tunneling Device' in the StarterPack, and one of it's parts is called 'Display'. Inside this is a SurfaceGui, inside that is a TextLabel, and inside that is the script I am using. I want to use the script to modify the text of the TextLabel so it says '0 / 50 Capacity', and if your leaderboard stat of 'Crystals' was 4 it would say '4 / 50 Capacity'. It would be nice if someone could help.

0
you have to make a loop and make the text the value greatneil80 2647 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
TextLable.Text = game.Player.LocalPLayer.LeaderStats.--Name of leaderstate
0
I have tried that but it isn't working. TopTomYT 2 — 6y
0
hmm idk know then make sure the name is right gummyxkiller 13 — 6y
0
it is all correct, I've heard u have to turn the leaderboard value into a string, but I don't know how TopTomYT 2 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Use the changed function. Example:

local text = TextLabel.Text --Your position of your textlabel

game.Players.LocalPlayer.leaderstats.Crystals.Value.Changed:connect(function() -- I said Value.Crystals
text = game.Players.LocalPlayer.leaderstats.Crystals.Value .. "/50 Capacity"
end)

game.Players.PlayerAdded:connect(function()
text = game.Players.LocalPlayer.leaderstats.Crystals.Value .. "/50 Capacity"
end)
0
it isn't working, how to fix? TopTomYT 2 — 6y
0
AH i made a mistake Beau192 0 — 6y
0
Fixed Beau192 0 — 6y

Answer this question