Typewriter Animation Effect?

I am wanting to make a draw.SimpleText that will add a character every delay. Kinda like a typewriter where it will one by one type one then I will add a sound to it. Any way of doing this?

I think, you will understand how to combine this


surface.PlaySound, Concatenation

Yeah, but is there a way where I can put the whole text in a table then use a loop to loop through and add a delay to each one?

local text = "This is the message you want to be drawn."

local time = CurTime()
local pos = 1

hook.Add("HUDPaint", "", function()
	if (CurTime() > time) then
		pos = pos + 1
		time = CurTime() + 0.3

	draw.DrawText(string.sub(text, 1, pos), "DermaDefault", 100, 100, color_black)