Typewriter "delay" problems with rich text

Sorry for the Title, I didn’t know how to word it correctly

Howdy, I am currently working on a dialogue system for my upcoming game. The typewriter script works perfectly fine with any normal text, but it doesn’t seem to work with rich text. I’m not exactly sure why this happens or how to fix it. With any normal text, the text stops right after the dot, but with rich text, it just keeps going for another bit of time. If anyone could help me with this, I would much appreciate it!

With rich text:


Without rich text: (how it’s supposed to work)

Local Script

    local function removeTags(str)
		str = str:gsub("<br%s*/>", "\n")
		return (str:gsub("<[^<>]->", ""))
	end

	local calculateNumber = removeTags(dialouge)
	local number = string.len(calculateNumber)
	print(number)

	repeat wait(.05)
		
		script.Sound:Play()

		textFrame.MaxVisibleGraphemes = textFrame.MaxVisibleGraphemes + 1

		if dialouge:sub(textFrame.MaxVisibleGraphemes - 0, textFrame.MaxVisibleGraphemes - 0) == "." then
			wait(1)
		elseif dialouge:sub(textFrame.MaxVisibleGraphemes - 0, textFrame.MaxVisibleGraphemes - 0) == "?" then
			wait(1.5)
		elseif dialouge:sub(textFrame.MaxVisibleGraphemes - 0, textFrame.MaxVisibleGraphemes - 0) == "!" then
			wait(0.75)
		elseif dialouge:sub(textFrame.MaxVisibleGraphemes - 0, textFrame.MaxVisibleGraphemes - 0) == "," then
			wait(0.5)
		end

	until textFrame.MaxVisibleGraphemes == number

Script

getRandomPlayer()
dialougeEvent:FireAllClients(randomPlayerName,[[This is <b>bold</b>. I can also write in <font color="rgb(255,125,0)">orange</font>. b]], randomPlayerImage)
1 Like

i have solved the issue myself

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