Typewriting Message Effect

Ello, I am simply making a UI for a game I am working on and how would I make it so all the messages repeat themselves so it doesn’t stop at the last message?

local textLabel = script.Parent.message
wait(1)

local function typewrite(object,text,length)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
end

typewrite(textLabel,"Welcome to the Canadian Army's Official Academy!",0.02)
wait(5)
typewrite(textLabel,"Buy gamepasses to support future development!",0.05)
wait(5)
typewrite(textLabel,"CoconutError is the Chief of Defence.",0.08)
wait(5)
typewrite(textLabel,"Report bugs in the bug reports channel of our dizzy!",0.11)

To who ever helps me thanks!

change the last 7 lines to

while true do
     typewrite(textLabel,"Welcome to the Canadian Army's Official 
     Academy!",0.02)
     wait(5)
     typewrite(textLabel,"Buy gamepasses to support future 
     development!",0.05)
     wait(5)
     typewrite(textLabel,"CoconutError is the Chief of Defence.",0.08)
     wait(5)
     typewrite(textLabel,"Report bugs in the bug reports channel of our 
     dizzy!",0.11)
     wait(5)
end

Thanks! Also while your online, why does the 3rd one slow down so much? Also updated script below.

local textLabel = script.Parent.message
wait(1)

local function typewrite(object,text,length)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
end

while true do
	typewrite(textLabel,"Welcome to the Canadian Army's Official Academy!",0.05)
	wait(5)
	typewrite(textLabel,"Buy gamepasses to support future development!",0.03)
	wait(5)
	typewrite(textLabel,"Report bugs in the bug reports channel of our dizzy!",0.5)
	wait(5)
	typewrite(textLabel,"Wanna raid? Check out the store to purchase weapons!",0.3)
	wait(5)
	typewrite(textLabel,"Don't wanna do training? Check the store to purchase ranks!",0.5)
end

video:

The delay time for each character is half a second long

I assume you meant to put 0.05?

Ohhh I can be so blind lol, tysm for the help!

Shouldn’t you be using MaxVisibleGraphemes instead? It literally says that it’s for creating a “typewriter effect”

Also, you should definitely be using task.wait(duration) over wait(duration) since it’s more accurate with the timing; task.wait counts by every heartbeat whereas regular wait counts by every 2nd heartbeat

1 Like