Help with updating surface gui text

basically i’m just making a gate teleport system, and i’ve made a string value in replicated storage which is the Time value which i made possible using a for loop, and then I now try to make a textlabel which is in a surfacegui inside of a part = to the Time.Value but it’s just not changing at all it just says label and I have tried getpropertychangedsignal and stuff it just doesnt want to change

Could you show your code? LocalScripts also don’t work in Workspace, you should put them in StarterPlayerScripts.

Could you please share the code you’re using, the type of script you’re working on, and any error messages you may have encountered?

Could you show your code and where the script was placed?

Can you please show the script to make it more clear?

local Time = game.ReplicatedStorage.Time
local label = workspace.Part.SurfaceGui.Time
while true do
for i = 30,0,-1 do
Time.Value = "Time: "…i
end
end
label.Text = Time.Value


this was in a serverscript in serverscriptservice as I want the whole server to see the same time.

It doesn’t update because you set .Text outside the loop.

Code:

local Time = game.ReplicatedStorage.Time
local label = workspace.Part.SurfaceGui.Time

while true do
	for i = 30, 0, -1 do
		Time.Value = "Time: ".. i
		label.Text = Time.Value
	end
end

You probably don’t even need the Time value in ReplicatedStorage.

   local Time = game.ReplicatedStorage.Time
local label = workspace.Part.SurfaceGui.Time
while true do
for i = 30,0,-1 do
Time.Value = "Time: "…tostring(i)
label.Text = tostring(Time.Value)
end
end

Try using the tostring() function.

Yeah, but outside the loop I also tried setting a getpropertychangedsignal on the value but still didnt work

Did you try my code?

I actually now just approached it without using a value from replicated storage and changing the text inside the for loop and it did work, thanks!

1 Like

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