How would I add a blinking "_" at the end of the string, which stops blinking when length changes

Well the title says it.
Here’s what I want to achieve:

function translationEffect(Ui: TextLabel | TextBox | TextButton)
	print(Ui, "\n" .. Ui.ClassName)
	local originalText = Ui.Text
	local stringLength, translatedStringLength = string.len(originalText), string.len(translation)

	while true do
		print(Ui, Ui.ClassName)
		task.wait()

		--TODO// add blinking "_" at the end of string //TODO--

		Ui.Text = originalText
		for count = stringLength, 0, -1 do
			task.wait(.15)
			Ui.MaxVisibleGraphemes	=	count
		end
		
		
		Ui.Text = translation

		for count = 0, translatedStringLength, 1 do
			task.wait(.15)
			Ui.MaxVisibleGraphemes	=	count
		end
	end
end