PANEL:Clear() Not Working X(

I’m making a scoreboard, but I’d like to clear an element on my scoreboard. When I use PANEL:Clear(), nothing happens. :frowning:

– main panel to lay shit out on
ASA.VGUI.ScoreboardPanel = vgui.Create( “DPanel”, ASA.MainBoard )
ASA.VGUI.ScoreboardPanel:SetPos( 10, 200 )
ASA.VGUI.ScoreboardPanel:SetSize( ASA.MainBoard:GetWide() - 20, ASA.MainBoard:GetTall() - 210 )
ASA.VGUI.ScoreboardPanel.Paint = function( pnl )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawRect( 0, 0, pnl:GetWide(), pnl:GetTall() )

-- main scoreboard button
ASA.VGUI.ScoreboardBtn = ASA.VGUI.ScoreboardButton( ASA.MainBoard, "Scoreboard", 150, 125, 150, 50 )
ASA.VGUI.ScoreboardBtn.DoClick = function( btn )
	if ASA.VGUI.ScoreboardOnTab == 1 then return end
	ASA.VGUI.ScoreboardPanel:Clear() -- clears all vgui from the panel
	ASA.VGUI.ScoreboardPanel.PaintOver = function( btn ) return end -- removes any additional paint done by the build previously viewed
	ASA.VGUI.BuildPlayerBoard( ASA.VGUI.ScoreboardPanel ) -- BUILD!!!
	ASA.VGUI.ScoreboardOnTab = 1


When I press my button, I want it to clear ASA.VGUI.ScoreboardPanel; but it doesn’t. :frowning:



"Additional Notes:

Will not work on all Panels."


Wait, but how would I do this regardless? :X

Panel = nil


I know that, it removes the panel; not clear it of all it’s children.

Remove the children.

How does one remove it’s children?

Same way you remove a panel.

Store the children upon creation.

If it’s a static design, store the child like ‘panel.MyList’ or ‘panel.MyCloseButton’.

If it’s a dynamic design (like rows for players), do ‘panel.MyRows[player:UserID()]’.

What I ended up doing was making 3 different DPanels and using SetVisible(). lol kinda cheating, but its works great!