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

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

Asked by 5 years ago
Edited 5 years 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. DeceptiveCaster 3761 — 5y
0
The concatenation operator is `..` not `,` EpicMetatableMoment 1444 — 5y

2 answers

Log in to vote
0
Answered by 5 years 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. DeceptiveCaster 3761 — 5y
0
Thank you 1devel0per0 & BashCaster. I really appreciate it. DevMonty 12 — 5y
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 145 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years 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... DeceptiveCaster 3761 — 5y
0
This doesn't solve his problem! EpicMetatableMoment 1444 — 5y
0
This doesn't solve it... DevMonty 12 — 5y
0
theres no difference between this code and his RobloxGameingStudios 145 — 5y
0
ok maybe i needed a .1 but still they both work good. RobloxGameingStudios 145 — 5y

Answer this question