Help with TypeWriter Effect that uses Table

I have been trying to get it a typewriter effect to work that references random variables at the Table to deliver at the Text. Can anyone help me out?

local TextTable = {
	[1] = "Testing",
	[2] = "Yolo"
}

local function typewriter(object,text,length)
	TweenService:Create(Text, TweenIn, {TextTransparency = 0}):Play()
	for i = 1, #text, 1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
	TweenService:Create(Text, TweenIn, {TextTransparency = 1}):Play()
end

while true do
	typewriter(Text, math.random(#TextTable), 0.02)
end return
local TextTable = {
	[1] = "Testing",
	[2] = "Yolo"
}

local function typewriter(object,text,length)
	TweenService:Create(Text, TweenIn, {TextTransparency = 0}):Play()
	for i = 1, #text, 1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
	TweenService:Create(Text, TweenIn, {TextTransparency = 1}):Play()
end

while true do
	typewriter(Text, TextTable[math.random(1, #TextTable)], 0.02)
end return

omg that did work tysm for that, where should I do the wait before it fades out to fade in to a new text again?

local TextTable = {
	[1] = "Testing",
	[2] = "Yolo"
}

local function typewriter(object,text,length)
	TweenService:Create(Text, TweenIn, {TextTransparency = 0}):Play()
	for i = 1, #text, 1 do
		object.Text = string.sub(text,1,i)
		task.wait(length)
	end
	TweenService:Create(Text, TweenIn, {TextTransparency = 1}):Play()
    task.wait(1.5)
end

while true do
	typewriter(Text, TextTable[math.random(1, #TextTable)], 0.02)
end return

alright appreciate it sm thank you for the help its already working as intended :sob: :heart:

1 Like

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