ScoreNine
|
  |
| Joined: 01 Jul 2017 |
| Total Posts: 85 |
|
|
| 16 Aug 2017 03:06 PM |
| so im making a robux clicker game and i have a text gui that tells the player how much cash they have but whenever i click and get the cash the gui stays at 0 but if i set the starting cash on the leaderboard to like 400 the gui will say 400 but again if i click for the cash no cash is displayed however it works on the leaderboard eg ########### etc here is my script local player = game.Players.LocalPlayer local label = script.Parent label.Text = "$"..player.leaderstats.Cash.Value i have tried it in both local and regular script but both wont work thanks for any help im a bit of a noob scripter but learning ;P |
|
|
| Report Abuse |
|
|
Ajastra
|
  |
| Joined: 01 Aug 2017 |
| Total Posts: 1461 |
|
|
| 16 Aug 2017 03:07 PM |
Hi Score. Try to click the Preview button before submitting a post to make sure it won't get filtered. Please repost your code. :)
|
|
|
| Report Abuse |
|
|
ScoreNine
|
  |
| Joined: 01 Jul 2017 |
| Total Posts: 85 |
|
|
| 16 Aug 2017 03:08 PM |
local player = game.Players.LocalPlayer local label = script.Parent
label.Text = "$"..player.leaderstats.Cash.Value
stupid filters and the way the forum works now like wth |
|
|
| Report Abuse |
|
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
|
| 16 Aug 2017 03:09 PM |
This is because you only run the code once.
Use a .Changed event on the Cash. Example:
cash.Changed:connect(function(change)
label.Text = change
end)
- RobuxLife | Discord - RobuxLife#4128 | |
|
|
| Report Abuse |
|
|
Ajastra
|
  |
| Joined: 01 Aug 2017 |
| Total Posts: 1461 |
|
|
| 16 Aug 2017 03:10 PM |
Alright, so from your post I understand that you want the label's Text to update with the Cash value.
Let's use the value object's Changed event to do this:
local player = game.Players.LocalPlayer local label = script.Parent
label.Text = "$"..player:WaitForChild("leaderstats"):WaitForChild("Cash").Value
player.leaderstats.Cash.Changed:Connect(function(newCash) label.Text = "$"..newCash end)
We pass a function to the event's Connect() method, which will be called when the event fires every time, and the newCash parameter will be the newly updated cash value.
I hope this is what you wanted!
|
|
|
| Report Abuse |
|
|
ScoreNine
|
  |
| Joined: 01 Jul 2017 |
| Total Posts: 85 |
|
|
| 16 Aug 2017 03:11 PM |
| ok ill give it a try thank you very much :) |
|
|
| Report Abuse |
|
|
ScoreNine
|
  |
| Joined: 01 Jul 2017 |
| Total Posts: 85 |
|
|
| 16 Aug 2017 03:14 PM |
| it worked like a charm, thanks a million :) |
|
|
| Report Abuse |
|
|