I made a typewriter effect module so I want to know your opinions:
local typewriter = {}
local function isExistingVal(...)
if ... then
return true
else
return false
end
end
function typewriter.new(obj, text, textDelay, callbackStart, callbackEnd)
if not isExistingVal(obj and text) then return end
if callbackStart then
callbackStart()
end
local tDelay
if textDelay then
tDelay = textDelay
else
tDelay = .05
end
obj.Text = text
obj.MaxVisibleGraphemes = 0
for i = 1, #text do
obj.MaxVisibleGraphemes += 1
task.wait(tDelay)
end
if callbackEnd then
callbackEnd()
end
end
return typewriter
You are free to use without credit if you please.