--Service

local RunService = game:GetService("RunService")

return function(obj, text, duration)
    local length = #text 
    local interval = duration / length 

    local con, lastUpdate, currentPos = nil, time(), 1
    con = RunService.RenderStepped:Connect(function()
        if time() - lastUpdate > interval then
            currentPos += 1
            obj.Text = string.sub(text, 1, currentPos)
            lastUpdate = time()

            if currentPos == length then
                con:Disconnect()
            end 
        end 
    end)
end 
