Derma check if open

[lua]local blah = vgui.Create(“DLabel”, myParent)
blah:SetPos(ScrW() / 2, ScrH() / 2) // Position
blah:SetColor(Color(255,255,255,255)) // Color
blah:SetFont(“default”)
blah:SetText(“PRESS E TO START ROUND”) // Text
blah:SizeToContents() // make the control the same size as the text.[/lua]
[lua]
hook.Add( “Think”, “MenuKeyListener”, function()
if ( input.IsKeyDown( KEY_E ) && blah ) then
blah:Remove()
isPlaying = true
end
end )
[/lua]
They are both in the same function. I want it to only do the thing if I press E while the menu derma text thing is actually opened. Not when in console, in chat, in the middle of a game etc. I was thinking of IsOpen() but that doesn’t exist.

blah.open = true

if blah.open then

maybe? it’s pseudocode, but should work.

I literally JUST tried something like that. It still starts even when blah.open = false.

Get rid of the local variable if you want to use it somewhere else, or define it on top the file. Then use IsValid( blah ) in the hook.