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
 

Re: TextLabel is not updating?

Previous Thread :: Next Thread 
Unic0de is not online. Unic0de
Joined: 19 Jul 2015
Total Posts: 27
28 Jul 2017 10:55 PM
Now, I have a textlabel that updates its text every time a numervalue is updated / changed.
For some reason, the textlabel isn't really updating when the numbervalue is changed.

Here's my script:

while true do
wait(.1)
script.Parent.Text.Text = script.Parent.Cash.Value
end
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
28 Jul 2017 10:57 PM
A TexLabel requires a string, not an integer.

script.Parent.Text.Text = tostring(script.Parent.Cash.Value)

Converting the integer(Cash.Value) into a string should work.


Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
28 Jul 2017 10:59 PM
while true do
script.Parent.Text.Text = script.Parent.Cash.Value
wait(.1)
end

Don't use loops ._.
Use Ancestry Changed or :getsignal.. something, I forgot


Wayk Mi Up Insyd
Report Abuse
Unic0de is not online. Unic0de
Joined: 19 Jul 2015
Total Posts: 27
28 Jul 2017 11:05 PM
Strange, it still doesn't work. It's like it's reading the first value and then not reading if it updates. I've checked the numbervalue, it's updating. There's no errors in the output either.
Report Abuse
Unic0de is not online. Unic0de
Joined: 19 Jul 2015
Total Posts: 27
28 Jul 2017 11:09 PM
Here's the script that's updating the number value...



(I cut up the script so it's not stolen or anything)

local Cash = game.StarterGui.Cash.Cash -- the numbervalue
local stolen = false

if stolen = true then

Cash.Value = Cash.Value +1
Report Abuse
good_evening is online. good_evening
Joined: 30 May 2010
Total Posts: 791
28 Jul 2017 11:10 PM
### Unless you're working down in the depths with assembly compiled lua, loops are perfectly fine in any shape or form.
Report Abuse
BaiYuni is not online. BaiYuni
Joined: 09 Oct 2009
Total Posts: 2861
28 Jul 2017 11:13 PM
???

It will still work and does not need to be converted.
Report Abuse
BaiYuni is not online. BaiYuni
Joined: 09 Oct 2009
Total Posts: 2861
28 Jul 2017 11:15 PM
And you're changing the cash from the StarterGui?

You should be doing it from PlayerGui.

And instead of a loop, it would be more efficient to use Changed or :GetPropertyChangedSignal("Value")
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
28 Jul 2017 11:17 PM
Oh yeah!

its :GetPropertyChangedSignal("Value")
I forgot xD


Wayk Mi Up Insyd
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
28 Jul 2017 11:18 PM
Doesn't Changed() fire on any property change? You can even use the parameters and check if the property is the Value property, if I'm not wrong

Pretty sure I've done it, and it's way cleaner than a while loop
Report Abuse
BaiYuni is not online. BaiYuni
Joined: 09 Oct 2009
Total Posts: 2861
28 Jul 2017 11:26 PM
Changed fires on any property change that is an Instance. Any other objects such as 'IntValue', 'StringValue', 'NumberValue' etc. only fires when the value changes.
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
28 Jul 2017 11:28 PM
Ah, okay
Report Abuse
Unic0de is not online. Unic0de
Joined: 19 Jul 2015
Total Posts: 27
29 Jul 2017 12:03 AM
I think it's a glitch or something with onClicked()... idk
Report Abuse
Briicks is online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
29 Jul 2017 12:06 AM
first off dont name something Text.

also you dont have to convert it to a string, the code below would work fine if you placed and named everything correct.

script.Parent.Cash.Changed:connect(function(x)
script.Parent.Text.Text = script.Parent.Cash.Value
end)


Report Abuse
BaiYuni is not online. BaiYuni
Joined: 09 Oct 2009
Total Posts: 2861
29 Jul 2017 12:39 AM
Why can't you name it Text?

And again, you should be changing the values from PlayerGui, not StarterGui.
Report Abuse
Briicks is online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
29 Jul 2017 12:39 AM
you can, if it does not have the property Text, but if it does then things can go wrong, it's just overall best to avoid that imo


Report Abuse
BaiYuni is not online. BaiYuni
Joined: 09 Oct 2009
Total Posts: 2861
29 Jul 2017 12:44 AM
So that it's not confusing? I'd agree.
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