Updating Player UI HelpSolved
void UpdatePlayerUI(BasePlayer player)
{
var container = new CuiElementContainer();


var Box_1 = container.Add(new CuiPanel
{
Image =
{
Color = "1 1 1 0.2691276"
},

RectTransform =
{
AnchorMin = "0.73125 0.8972222",
AnchorMax = "0.9953126 0.9444444"
},

CursorEnabled = false
});

var Box_2 = container.Add(new CuiPanel
{
Image =
{
Color = "1 1 1 0.2691276"
},

RectTransform =
{
AnchorMin = "0.73125 0.8379627",
AnchorMax = "0.9953125 0.886111"
},

CursorEnabled = false
});

var USER_1 = container.Add(new CuiLabel
{
Text =
{
Text = "USERNAME 1",
FontSize = 14,
Align = TextAnchor.MiddleLeft

},

RectTransform =
{
AnchorMin = "0.7359375 0.9083333",
AnchorMax = "0.9291667 0.9379629"
}

});

var USER_2 = container.Add(new CuiLabel
{
Text =
{
Text = "USERNAME 2",
FontSize = 14

},

RectTransform =
{
AnchorMin = "0.7348959 0.8509259",
AnchorMax = "0.9296875 0.8722222"
}

});


var USER_SCORE1 = container.Add(new CuiLabel
{
Text =
{
Text = "5",
FontSize = 14,
Align = TextAnchor.MiddleLeft

},

RectTransform =
{
AnchorMin = "0.9760417 0.9111109",
AnchorMax = "0.9895833 0.9333332"
}

});


var USER_SCORE2 = container.Add(new CuiLabel
{
Text =
{
Text = "4",
FontSize = 14,
Align = TextAnchor.MiddleLeft

},

RectTransform =
{
AnchorMin = "0.9760419 0.848148",
AnchorMax = "0.9875001 0.8777776"
}

});


var TXT_HDR = container.Add(new CuiLabel
{
Text =
{
Text = "Score",
FontSize = 20

},

RectTransform =
{
AnchorMin = "0.8484375 0.9472222",
AnchorMax = "0.9005209 0.9833333"
}

});

CuiHelper.AddUi(player, container);
}

void UpdatePlayers()
{
foreach(BasePlayer player in BasePlayer.activePlayerList as List<BasePlayer>)
{
CuiHelper.DestroyUi(player, "container");
UpdatePlayerUI(player);
}
}​


Code above is my ui, which works perfectly excecept when I want to update the player score the ui updates but it does not destroy the old one. So it constantly overlaps the old ui w/ the new 1. I call UpdatePlayers(); whenever the player dies but it isnt shown above. I am pretty sure I am doing something wrong with CuiHelper.DestroyUi(player, "container"); I just don't know what it is
Locked automatically