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

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

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.

1 comment

0

you have to make a loop and make the text the value

2 answers

TextLable.Text = game.Player.LocalPLayer.LeaderStats.--Name of leaderstate

3 comments

0

I have tried that but it isn't working.

0

hmm idk know then make sure the name is right

0

it is all correct, I've heard u have to turn the leaderboard value into a string, but I don't know how

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)

3 comments

0

it isn't working, how to fix?

0

AH i made a mistake

0

Fixed

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