Derma auto closing/timer?

Basically, I have a frame that I want to set it’s visibility to false after a period of 30 seconds, but I can’t figure out how to get a timer to call the actual function correctly. Here’s what I’ve got:

[lua] local scoin_motd_BackGround = vgui.Create(“DFrame”)
scoin_motd_BackGround:SetSize(600,300)
scoin_motd_BackGround:SetPos( (ScrW()/2)-(scoin_motd_BackGround:GetWide()/2),(ScrH()/2)-(scoin_motd_BackGround:GetTall()/2))
scoin_motd_BackGround:SetTitle(“ShankShock MOTD”)
scoin_motd_BackGround:SetVisible(true)
scoin_motd_BackGround:SetDraggable(false)
scoin_motd_BackGround:ShowCloseButton(true)
scoin_motd_BackGround:MakePopup()
scoin_motd_BackGround.Paint = function()
draw.RoundedBox(4,0,0,scoin_motd_BackGround:GetWide(), scoin_motd_BackGround:GetTall(), Color(242,242,242,200))
draw.RoundedBox(2,2,2,scoin_motd_BackGround:GetWide()-4,21, Color(50,50,50,200))
timer.Simple(30, function()
scoin_motd_BackGround:SetVisible(false)
end)
end

local TextArea = vgui.Create("DTextEntry", scoin_motd_BackGround)
TextArea:SetSize(250,250)
TextArea:SetPos(5,29)
TextArea:SetEditable(false)
TextArea:SetMultiline(true)
TextArea:SetValue(motdText)
[/lua]

You have the right idea, but I’m not really sure why you make the timer in a paint hook. That way, you make the timer every frame (bad idea). Just make it once after you’ve made the frame.

Thanks a ton, works like a charm now. Apparently I was having issues before when it was outside the paint hook with forgetting the closing ) on the timer:
[lua]
timer.Simple(30, function()
–stuff
end
[/lua]

Thanks!