'Text' property from TextLabel only updates once RichText is enabled

I’m experiencing a bug; I try to update the ‘Text’ property of a TextLabel with the following code


updateUIItemCount.Event:Connect(function()

	local function updateBillboard(customBillboard)
		local Container_Items = customBillboard:WaitForChild("Background_NPC"):WaitForChild("QuestionFrame"):WaitForChild("Container_Items")

		for _, itemFrame in ipairs(Container_Items:GetChildren()) do
			if not string.find(itemFrame.Name, "ItemFrame") then 
				continue 
			end

			local ViewportContainer = itemFrame:WaitForChild("ViewportContainer")
			local viewPort = ViewportContainer:FindFirstChildOfClass("ViewportFrame") 

			local AmountLabel = ViewportContainer:FindFirstChild("AmountLabel")
		
			local itemName = viewPort.Name
			local amount = tonumber(string.split(AmountLabel.Text, "/")[1])
			local inventoryAmount = tonumber(LocalPlayerData.Inventory[itemName])

		
			AmountLabel.Text = tostring(string.format(strFormatAmountVSInventoryAmount, amount, inventoryAmount))
		end
	end

	local NPCFolder = LocalPlayerData.Plot.plotFolder:WaitForChild("NPC_Folder")
	for _, npc in ipairs(NPCFolder:GetChildren()) do
		local billboard = npc:FindFirstChild(NPC_CustomBillboard.Name)
		if billboard then
			updateBillboard(billboard)
		end
	end

	local gui = getScreenGui()
	local billboard = gui:FindFirstChild(NPC_CustomBillboard.Name)
	if billboard then
		updateBillboard(billboard)
	end
end)

Everything works just fine; in the Property window, I notice that the text property is indeed the value I have set it to. Though, I don’t see the text visual on my screen. The visible property is true, the position is correct, everything should be fine. And everything does work once I set the rich text property to true.

Additionally, when I change the text in the property window manually, then the visual text inside of the textlabel does change.

A private message is associated with this bug report

Try and Ensure that PlayerItems has the correct data model for each item
and that Validate that AmountLabel.Text (or what ever you call it) is formatted right for every item

I’m 100% sure that all that kinds of parameters are correct.

I’m convinced this is a studio bug.

Thanks for thinking with me though!

Attaching a repro place file would help engineers looking over this!

1 Like