Need help with a Rich Text issue

Hello! I am trying to fix a rich text issue.

Before, it will say:
Hello! I am <font color="#FFA500"Haren</font

But once all of the RichText is in the TextLabel, it will be normal like this:
Hello! I am Haren. What is your name?

And before you ask about the colored text, read this: https://devforum.roblox.com/t/developer-forum-formatting-guide/456083/


Here is a video of the issue:


Here is the code:

local text

text = 'Hello! I am <font color="#FFA500">Haren</font>. What is your name?'
for i = 1, #text do
	script.Parent.Text = string.sub(text, 1, i)
	script.Parent.Parent.Parent.ChatSound:Play()
	wait(0.005)
end

If you have a solution, please let me know, thanks, WE

2 Likes

You would need to implement a system to automatically close off open tags on run time and add in the characters to that specific tag. If you don’t want a complicated solution, I’d suggest using this module which supports RichText.

tbh, I really don’t want to use this because Heartbeat is deprecated.
image
Could you provide the complicated solution?

You should just fork the module so that it uses PostSimulation instead. Looks like the new events aren’t even out yet, but that should work for now.

The event has not been replaced yet because the new one does not even work yet.

-- Prints nothing
game:GetService("RunService").PostSimulation:Connect(function()
	print("a")
end)

As soon as they are officially released, I will replace them in the module.

1 Like