Custom Playerlist Issues

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;

--

Well the issue would be that the current frames are not destroying. Are you sure its a frame and not a ImageLabel or something like that? Its probably a ImageLabel considering the curved corners

I’m as blind as a bat lol. Thanks for the help. :grinning_face_with_smiling_eyes:

1 Like