how to show string on screen for a while ?

i know these code can show string on screen, but i want the text disappeared in ten second, how to do so ? thank you in advance
hook.Add( “HUDPaint”, “HelloThere”, function()
draw.DrawText( “Hello there!”, “TargetID”, ScrW() * 0.5, ScrH() * 0.25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end )

timer.Simple( number delay, function func )
4.3.1 – if then else



local shouldShow = true
timer.Simple(10,function()
	shouldShow = false
end)

hook.Add( "HUDPaint", "HelloThere", function()
	if !shouldShow then return end
	-- drawcode
	
end)


The other option is to do it with VGUI, then you just do



// CLIENT-SIDE
function showString(str)
    local string = vgui.Create("DLabel")
    string:SetText(net.ReadString())
    string:SetPos( x, y )
    ...

    timer.Simple(net.ReadInt(8), function()
        string:Remove()
    end )
end
net.Receive("XXX", showString )

// SERVER-SIDE
net.Start("XXX")
    net.WriteString("This is my message")
    net.WriteInt( 5, 8 )
net.Broadcast()


If the above has errors then sorry, I’ve just been moving PC’s between rooms for about 3 hours and am a little worn out!