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

Changing TextLabel text to match data on leaderstats? (Gui Question)

while true do	
wait()	
script.Parent.Text = "$", game.Players.LocalPlayer.leaderstats.Money.Value
end

I am trying to make it so the TextLabel displays the value of leaderstats with a dollar sign in front of it. I thought a comma would work. Thank you in advance.

2 comments

0

Use two dots. A comma is only used in either tuples, tables, or defining multiple variables as multiple values.

0

The concatenation operator is .. not ,

2 answers

✓ Accepted answer
--EASY FIX:

while wait(.1) do -- wait(.1) shortens the code and stops a game script timeout.
script.Parent.Text = "$"..game.Players.LocalPlayer.leaderstats.Money.Value -- Changes the text
end

Theres your fix!

3 comments

0

Please don't spoonfeed code.

0

Thank you 1devel0per0 & BashCaster. I really appreciate it.

0

How is this better than mine, this requires more typing, also mine isnt as spoonfeeding. so yea, i dont see how mine does not work :( i use that method all the time and it works fine.

wow, u forgot a 's', also your comma was not needed! This code was not working due to a simple spelling error.

My Fixed Up Code:

while true do   
wait()  
script.Parent.Text = "$" game.Players.LocalPlayer.leaderstats.Money.Value -- forgot a s here and the comma is not needed
end

Your Code:

while true do   
wait()  
script.Parent.Text = "$", game.Players.LocalPlayer.leaderstat.Money.Value 
end

as you can see, it is leaderstat instead of leaderstats. Also the comma is not needed. Hope this helps, Enjoy!

5 comments

1

That doesn't fix his problem. You're missing something a bit obvious...

0

This doesn't solve his problem!

0

This doesn't solve it...

0

theres no difference between this code and his

0

ok maybe i needed a .1 but still they both work good.

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