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:

[lua]
– 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() )
end

-- 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
end

[/lua]

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

[editline]10:21PM[/editline]

ME IS STUPID NUB AT LAU!!!

**[Panel.Clear

http://i.imgur.com/eJ2Yc.png](wiki.garrysmod.com/?title=Panel.Clear)**
"Additional Notes:

Will not work on all Panels."

[editline]10:22PM[/editline]

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

[lua]
Panel:Remove()
Panel = nil
[/lua]

:wink:

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!