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 1 year 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

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

Answer this question