Closing a GUI problems.

Hey guys, well I have a problem, I have this code to close a GUI, it worked the other week but now I went to test it and it doesn’t could someone point me in the right direction to why this isn’t closing.

[lua] local Button_Close = vgui.Create( “DButton”, FrameInv )

Button_Close:SetPos( 2, FrameInv:GetTall( ) - 25 )
Button_Close:SetSize( FrameInv:GetWide( ) - 4, 20 )

Button_Close:SetText( "Close" )

Button_Close.DoClick = function( )

	InvCloseFrame( )

end

end

function InvCloseFrame( )

if ( FrameInv ) then

	FrameInv:SetVisible( false )
	FrameInv = nil

end

end[/lua]

Post the entire code please and an error if there is one, because there is no problem with what you’ve posted so far.

No errors, and none of my other code will cause it, its something to do with that.

Why are you doing:

FrameInv:SetVisible(false)
FrameInv = nil

FramInv:SetVisible(false) would suffice nilling it is just a waste.

Yea your totally right, I’m just asking to see your code because I want to steal it, not that I’m trying to help you or anything.

Not if he wants to get rid of the frame.

I assumed since he used SetVisible then nulled it that he might have been trying to reuse it without remaking it. Otherwise he could of used:

FrameInv:Remove()

Although there isn’t much difference.