I’m currently working on a custom playerlist. I decided to test it out in a 2 player server, and for some reason, when the second player joins the game, the player that was in the server first has their name duplicated. But then when the second player leaves, their name isn’t erased from the player list and the players name is duplicated once more:
Here’s the code I’ve used for the list:
-- Variables
local PlayerListFrame = script.Parent.Parent.PlayerListFrame;
local PlayerList = {};
--
-- Functions
function PlayerList.UpdateList()
-- For loop
for i, child in pairs(PlayerListFrame:GetChildren()) do
if child:IsA("Frame") then
child:Destroy();
end
end
for i, player in pairs(game.Players:GetPlayers()) do
local playerFrame = script.Player:Clone();
playerFrame.Text = player.Name;
playerFrame.Name = player.Name;
playerFrame.Parent = PlayerListFrame;
end
end
--
-- Return module
return PlayerList;
--
