Here is my script, Please help me!
01 | --Variables |
02 | local plr = game.Players.LocalPlayer |
03 | local cash = script.Parent.Cash.Value |
04 | local show = script.Parent |
05 |
06 | --Script |
07 | while ( 1 ) do |
08 | show.Text = cash |
09 | print (cash) |
10 | wait( 0.1 ) |
11 | end |
Actually, this script works fine. May not be the most efficient, but let's be honest, we all did that once. Although the **while wait(1)* and then the wait(0.1) seems a bit odd. while wait(1.1) will do the same. New thought: Did you make sure the script is inside a label or textbox?
At the time you define cash, you're explicitly setting it to the Cash's value - it won't update if the value updates, it'll stay at the value it got at that time.
Let's assume cash has a value of 5 when you define it, but it increments - that variable still has a value of 5. In order to overcome this, remove .Value
from line 3, and on line 8, in your while loop, change it to:
1 | show.Text = cash.Value |
I hope that helped!
What you are doing will never work so instead do this
1 | local plr = game.Players.LocalPlayer |
2 | local cash = script.Parent.Cash.Value |
3 | local show = script.Parent |
4 |
5 | script.Parent.Cash.Changed:connect( function () |
6 | show.Text = cash |
7 | print (cash) |
8 | wait( 0.1 ) |
9 | end ) |