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

How to get the value of a leaderstat?

Asked by 9 years ago

Hi. How would I get the value of a leaderstat (Like the number 245 for example) to reside in a TextBox? (This leaderstat will be changing. How would I make the number on the GUI stay with the value of the leaderstat?

Thanks!

0
You would use the Changed event in the script that deals with the text in your TextBox. http://wiki.roblox.com/index.php?title=API:Class/Instance/Changed Redbullusa 1580 — 9y

1 answer

Log in to vote
0
Answered by
woodengop 1134 Moderation Voter
9 years ago

Try doing this

local gui = script.Parent

gui.Text = ""..game.Players.LocalPlayer.leaderstats.Cash.Value

in Lua the .. Means to Include, Like for example You want to Add the Players name into a Welcome Gui then we would write it in this way:

script.Parent.Text = "Welcome "..game.Players.LocalPlayer.Name

You can also Do More than to just a Player's name, you can add Something that exists in Workspace or any other Containers.

Hope this helps.

Ad

Answer this question