Why won't my code to make a list of all players in-game work?

I want to make a GUI with a list of all players currently in-game, displaying info about the player such as their name, display name, and headshot image. Currently, my script only adds one player to the list(me, same happens to a friend who tried it for me). I’ve tried using .PlayerAdded but to no avail. Here’s the code I currently have in place:

local gangPart = game:GetService('Workspace'):WaitForChild('gangPart')
local Players = game:GetService("Players")
local PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui")

local GangGui = script.Parent
local PlayerList = GangGui:WaitForChild("PlayerList")
local PlayerTemplate = PlayerList:WaitForChild("PlayerTemplate")
local InviteBox = GangGui:WaitForChild("InviteBox")
local Notifications = GangGui:WaitForChild("Notifications")

function setPlayerImage(player, PlayerImage)
	local userId = player.UserId
	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size48x48
	local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
	PlayerImage.Image = content


function gangPartClicked(player)
	print(player.Name.." clicked the button")

print("line 32")

local function playerAdded(player)
	local timesLooped = 0

		local cloneTemplate = PlayerTemplate:Clone()
		cloneTemplate.Name = "clonedTemplate_".. player.Name
		cloneTemplate.PlayerName.Text = player.Name
		cloneTemplate.PlayerDisplayName.Text = player.DisplayName
		cloneTemplate.Visible = true

		cloneTemplate.Parent = player.PlayerGui.GangGui.PlayerList
		if timesLooped >= 1 then 
			cloneTemplate.Position += UDim2.fromScale(0, 0.11)
			PlayerTemplate.Visible = false
			print("only one player")
		setPlayerImage(player, cloneTemplate.PlayerImage)
		local cloneInviteBox = InviteBox:Clone()
		cloneInviteBox.Name = "clonedInviteBox_"..player.Name
		cloneInviteBox.Parent = GangGui
		if timesLooped >= 1 then
			cloneInviteBox.Position += UDim2.fromScale(0, 0.11)

			cloneInviteBox.Visible = not cloneInviteBox.Visible
			print("image clicked")
		timesLooped += 1
		print("Gui successfully loaded in")



for _, player in ipairs(Players:GetPlayers()) do

print("line 63")


you can use a for loop to go through the players in the game:

for i, v in pairs(game.Players:GetChildren())
-- get player info and stuff in here, and add it to a table if you want

I already have that, it looks like this and its at the bottom of the script.

for _, player in ipairs(Players:GetPlayers()) do

have you tried getting the player data in the loop, then add the data to a table so you can display it later?

I’m not sure if it’ll make much of a difference but I guess I’ll try it tomorrow.