New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 7 months ago
Edited 7 months ago
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.

0
Use two dots. A comma is only used in either tuples, tables, or defining multiple variables as multiple values. BashCaster 2676 — 7mo
0
The concatenation operator is `..` not `,` EpicMetatableMoment 1094 — 7mo

2 answers

Log in to vote
0
Answered by 7 months ago
--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!

0
Please don't spoonfeed code. BashCaster 2676 — 7mo
0
Thank you 1devel0per0 & BashCaster. I really appreciate it. MusicalMonty 10 — 7mo
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. RobloxGameingStudios 146 — 7mo
Ad
Log in to vote
0
Answered by 7 months ago
Edited 7 months ago

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!

1
That doesn't fix his problem. You're missing something a bit obvious... BashCaster 2676 — 7mo
0
This doesn't solve his problem! EpicMetatableMoment 1094 — 7mo
0
This doesn't solve it... MusicalMonty 10 — 7mo
0
theres no difference between this code and his RobloxGameingStudios 146 — 7mo
0
ok maybe i needed a .1 but still they both work good. RobloxGameingStudios 146 — 7mo

Answer this question