I'm trying to make a dialogue system where if the player left clicks while its playing the dialogue, it skips it and sets out all the text on the gui, my issue is that it takes forever for it to set out each character now how do I fix this?

heres the code

local function typewrite(object,text,speed)
	for i = 1,#text,1 do

		object.Text = string.sub(text,1,i)
		if KeyVerify() then
			object.Text = text
			return
		end
		wait(speed)
	end
end

any help would be appreciated