Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

loop slows down when checking for player mouse input via a function?

Asked by 2 years ago

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

01local function typewrite(object,text,speed)
02    for i = 1,#text,1 do
03 
04        object.Text = string.sub(text,1,i)
05        if KeyVerify() then
06            object.Text = text
07            return
08        end
09        wait(speed)
10    end
11end

any help would be appreciated

Answer this question