How do I make text constantly update?

I want to make a script that calls on a number value to edit text

  1. It doesn’t update in game

    Even when I change the value it doesn’t update.

My script works fine when I start the game, but then when the value gets changed it the game it doesn’t change the text. Here’s the script:

local value = script.Parent.Parent.wood

	script.Parent.Text = "Gather Wood "..value.Value.. "/5"

It starts with 0 which is what the value is originally set to, but then if updated it doesn’t change.

Any help appreciated!

1 Like

you could copy this text and make it say

value.Changed:Connect(function()
	script.Parent.Text = "Gather Wood "..value.Value.. "/5"
end)

this would update the text everytime the value is changed

1 Like

Wait it didn’t work… same issue

The text doesn’t update after you change the value?

No it doesn’t… It’s the same thing

It’s not supposed to do that. You need to tell it to wait for changes in the value using a relevant event handler, and modify the value again in the callback function. The code in your script will only run once depending on where it is located.

What errors are you currently getting? What type of script are you using and where is it located?

Are you sure you’re modifying the value on the server side (if the code is running in a server script)? It seems your post boils down to a problem involving client-server data replication, which has been appearing on the forums regularly for about 4 years now.

1 Like

If the script is a local script editing the value on the client or server side shouldn’t matter, that’s why I was confused as to why it wasn’t working

It’s a local script, and it’s parented under the gui. No errors in the console for the client OR the server

Your code should work, I wonder why it isn’t.

1 Like

can you send what the script currently looks like after you added the change I suggested

Could try using :GetPropertyChangedSignal

NumberValue:GetPropertyChangedSignal("Value"):Connect(function()
    local Amount = tostring(NumberValue.Value)
    TextLabel.Text = "Gather Wood "..Amount.."/5"
end)

Still doesn’t work. Here is how it’s layed out:
image
and here is the script

are you changing the value manually through properties or is there a script that changes value?

Well for now im testing it by changing it manually, but there will be a script that changes it

that’s the issue. You’re changing value manually inside StarterGui. Your actual Gui is in the Players > Your Player Instance > PlayerGui > Gui
That’s where you should change the value manually, otherwise use a script
the script is working fine

2 Likes

thank you so so so so much! :+1: