TextLabel does not update

I am updating a TextLabel from a LocalScript and the TextLabel is always one update behind on the “updating” part

When I change the text property of the Label using a script, it updates once, then halts, and from then on it is always one update behind on rendering of the Text. According to the script and my Properties window, the label is at the scripts set value. But the Label refuses to render untill I wait and change the text again.

Demonstration:

What I have tried:

Reinstalling studio
Tested on another device
Tested on the roblox website
Imported the project to another Studio Project

Neither of the above works

Tell me if you need anything more or if everything works alright for you!

Isolated place file:
Placefile.rbxl (49.1 KB)

6 Likes

Do you have a cool-down for it to update? If not, try that.

?

There should be absolutely no cooldown between the TextLabel.Text and the rendered text. This is a bug.

2 Likes

Oh, ignore then. I thought a cool-down was needed

Thanks for the report! We’ll follow up when we have an update for you.

1 Like

I ran into this today and thought I was losing my mind.

In an additional wrinkle, I found that the text would update if I moused over it, oddly enough.

I was able to find a workaround in my situation, though: I was originally updating the text in a RenderStepped connection, but switching it to Heartbeat fixed the issue. It’s fine in this case since it doesn’t need to be frame-perfect or anything, but it definitely threw me for a loop.

1 Like

I’m experiencing the same thing. The text value changed on the properties but on screen it doesn’t tally up. It will update once you select the text label on explorer or hover your mouse on the text label.

2 Likes

I was helping someone in #help-and-feedback:scripting-support who turned out to be experiencing this bug.

I was able to reproduce this on a blank baseplate in studio with the following code in a LocalScript:

-- This code goes in a LocalScript and needs no further setup.
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")


local player = Players.LocalPlayer
local playerGui = player.PlayerGui


local screen = Instance.new("ScreenGui")

local textLabel = Instance.new("TextLabel")
textLabel.Text = "0"
textLabel.TextColor3 = Color3.new(1, 1, 1)
textLabel.TextScaled = true
textLabel.Size = UDim2.fromOffset(200, 50)
textLabel.BackgroundTransparency = 1
textLabel.Parent = screen

screen.Parent = playerGui


local targetValue = Instance.new("NumberValue")
local interpolValue = Instance.new("NumberValue")

targetValue.Changed:Connect(function()
	local tween = TweenService:Create(interpolValue, TweenInfo.new(2, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {Value = targetValue.Value})
	tween:Play()
	tween.Completed:Wait()
	task.wait(3)
	targetValue.Value *= -1
end)

interpolValue.Changed:Connect(function()
	-- Putting task.wait() or game:GetService("RunService").Heartbeat:Wait() here prevents the issue
	textLabel.Text = tostring(math.round(interpolValue.Value))
end)

targetValue.Value = 800

textlabel_bug
(Hovering over the TextLabel causes it to update and properly show the .Text property)

The issue no longer happens when deferred events are off (Workspace.SignalBehavior is set to Immediate).

A work around is waiting for heartbeat (either directly or with task.wait) before updating the .Text property.

6 Likes