Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make text update to value?

I'm trying to make a text in a gui, (TimerText), be set to the value of TimeValue. It seems that TimerText is not updating although it is ran in a while true loop. I made sure that TimeValue is being changed through prints, so that shouldn't be the problem. Does anyone have any ideas of what I'm doing wrong?


local TimeValue = game.StarterPlayer.StarterPlayerScripts.LocalTimer.Time.Value
local TimerText = game.StarterGui:WaitForChild("ScreenGui"):WaitForChild("Timer").Text 
	while true do
		TimerText = TimeValue
		wait(.1)
	end

1 answer

TimerText is a string. You want the object. You also want to put the variables in the loop so it fetches the updated values

local TimerText = game.StarterGui:WaitForChild("ScreenGui"):WaitForChild("Timer")
while true do
    local TimeValue = game.StarterPlayer.StarterPlayerScripts.LocalTimer.Time.Value
    TimerText.Text = TimeValue
    wait(.1)
end

You can shorten it more but no need. If you have any questions or if something doesn't work, comment below and I'll reply. Make sure to click accept if it does work.

This discussion is preserved as it was. New answers, comments, and votes are closed.