generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Small scripting problem

Previous Thread :: Next Thread 
ScoreNine is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. ScoreNine
Joined: 01 Jul 2017
Total Posts: 85
16 Aug 2017 03:14 PM
it worked like a charm, thanks a million :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image