Text not updating when value changed

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local status = ReplicatedStorage:WaitForChild("Status")
local text = script.Parent.Text

text = status.Value

status:GetPropertyChangedSignal("Value"):Connect(function()
	text = status.Value
end)

No error, the value is changed but the text are not updating since the game started

Not totally sure but I think your ‘text’ variable may just be set to the string that was inside the GUI, instead of the actual property. Try:

...
local text = script.Parent

text.Text = status.Value

status:GetPropertyChangedSignal("Value"):Connect(function()
	text.Text = status.Value
end)

Here all I did was get the GUI’s ‘Text’ property every time so that, instead of changing just the ‘text’ variable, it changes the actual value.
Hopefully I’m not horribly incorrect :stuck_out_tongue:

uh no the text wasnt same like the text inside the textlabel

Is this the entire script? Because then you could just use repeat to do it.

while true do
	task.wait(3)
	
	status.Value = "Waiting for enough players (".. #Players:GetPlayers().."/".. minPlayer..")"

sorry i cant show the full script but this is the part where it change the value

As far as I can tell, what I previously said seems to be the solution. Currently, the Text seems to be not updating because local text is simply set as ‘Loading…’ (the string that was inside of the TextLabel) instead of the actual, changeable property. All you are doing by writing text = status.Value is changing the variable from ‘Loading…’ to status.Value. Not the actual GUI Text property.
You can test if this is correct by printing the value of text.

EDIT: I tested your exact code in studio and the solution is what I wrote.

1 Like

this should work. 30charcharchar

1 Like

not working
but i fix it

for i, v in pairs(Players:GetPlayers()) do
					if v.Character then
						local status = v.PlayerGui:WaitForChild("StageSystemGui").MainFrame.Status
						status.Text = player1.Name.. "Is the winner! (player 1)"
					end
				end

yes ty

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.