Removing vgui

Hello, i’m making a custom scoreboard with vgui.create(“avatarimage”) and remove it with Remove(). I am not getting any errors but it doesn’t seem to get removed.



local x = 0
function ScoreBoard()
	local client = LocalPlayer()
	if (client:KeyDown(IN_SCORE)) then
		surface.SetDrawColor(Color(0,0,0,150))
		surface.DrawRect(sw/2*0.5, sh/2*0.2, 500, 600)
	local num = table.Count(player.GetAll())
	plytb = player.GetAll()
		for i=1, num do
			x = i * 30
			surface.SetDrawColor(Color(255,0,0,255))
			T = {}
			T* = vgui.Create("AvatarImage")
			//T* = vgui.Create("DFrame")
			T*:SetSize(32,32)
			T*:SetPos(sw/2*0.5050, sh/2*0.133+x)
			T*:SetPlayer(plytb*)
			surface.DrawRect(sw/2*0.5050, sh/2*0.15 + x, 15, 15)
			draw.SimpleText(plytb*:GetName(), "HealthFont", sw/2*0.60, sh/2*0.15 + x, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
		end
	end
end
hook.Add("HUDPaint", "ScoreBoard", ScoreBoard)

function RemoveVGUI(ply, key)
	if (key == IN_SCORE) then
		for i=1, table.Count(player.GetAll()) do
			T*:Remove()
		end
	end
end	
hook.Add("KeyRelease", "RemoveVGUI", RemoveVGUI)


The error is located at T*:Remove() in the function RemoveVGUI.

Also I tried making it a not local already and creating the table T outside the function.

I discovered the problem never mind.