When a 2nd player joins he cant see the 1st player

I’m currently making a custom player list and i ran into a problem. When a new player joins, the players that joined before the new player can’t be seen on the new player’s player list. PlayerEvent is a RemoteEvent.
1st script (PlayerEventManager):

local RE = game:GetService("ReplicatedStorage").PlayerEvent

game.Players.PlayerAdded:Connect(function(player)
repeat task.wait() until player.Character and player.PlayerGui
RE:FireAllClients(player, true)
end)

game.Players.PlayerRemoving:Connect(function(player)
RE:FireAllClients(player, false)
end)

2nd script (Manager):

local RE = game:GetService("ReplicatedStorage").PlayerEvent
local Players = game:GetService("Players")

RE.OnClientEvent:Connect(function(player, Type)
    if Type == true then
        local template = script.Parent.TemplateFolder.Template:Clone()
        template.Name = player.Name

        template.DisplayName.Text = player.DisplayName
        template.PlayerName.Text = "@"..player.Name

        local userId = player.UserId
        local thumbType = Enum.ThumbnailType.HeadShot
        local thumbSize = Enum.ThumbnailSize.Size420x420
        local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

        template.Player.Image = content

        template.Parent = script.Parent
        template.Visible = true
    elseif Type == false then
        for _, frame in pairs(script.Parent:GetChildren()) do
            if frame:IsA("Frame") and frame.Name == player.Name then
                frame:Destroy()
            end
        end
    end
end)

Picture of the location:
da1af60ea8e200f552f953fd38427021bf9d9812

Since it’s on the client side, the second player only sees himself, because the previous player was added before he joined. You should make it, so when the player joins, all previous players add to the leaderboard on his client, or just try to make the leaderboard server sided.

Apologies for the late response but I just happened to have some free time. What you said is correct I just realised it when you said it. But how exactly should I do that? I’m a beginner scripter and I had my friend help me with this script. I tried using a RemoteFunction InvokeServer but that didn’t really seem to work.

try this

--PlayerEventManager
local RE = game:GetService("ReplicatedStorage").PlayerEvent

game.Players.PlayerAdded:Connect(function(player)
repeat task.wait() until player.Character and player.PlayerGui
RE:FireAllClients(player, true,"UpdateEveryone")
RE:FireClient(player,true,"AddEveryone")
end)

game.Players.PlayerRemoving:Connect(function(player)
RE:FireAllClients(player, false)
end)

--Manager
local RE = game:GetService("ReplicatedStorage").PlayerEvent
local Players = game:GetService("Players")

RE.OnClientEvent:Connect(function(player, Type,Update)
    if Type == true and Update = "UpdateEveryone" then
        local template = script.Parent.TemplateFolder.Template:Clone()
        template.Name = player.Name

        template.DisplayName.Text = player.DisplayName
        template.PlayerName.Text = "@"..player.Name

        local userId = player.UserId
        local thumbType = Enum.ThumbnailType.HeadShot
        local thumbSize = Enum.ThumbnailSize.Size420x420
        local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

        template.Player.Image = content

        template.Parent = script.Parent
        template.Visible = true
    elseif Type == false then
        for _, frame in pairs(script.Parent:GetChildren()) do
            if frame:IsA("Frame") and frame.Name == player.Name then
                frame:Destroy()
            end
        end
    elseif Type == true and Update == "AddEveryone" then
      for i,player in pairs(game.Players:GetChildren()) do
        local template = script.Parent.TemplateFolder.Template:Clone()
        template.Name = player.Name

        template.DisplayName.Text = player.DisplayName
        template.PlayerName.Text = "@"..player.Name

        local userId = player.UserId
        local thumbType = Enum.ThumbnailType.HeadShot
        local thumbSize = Enum.ThumbnailSize.Size420x420
        local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

        template.Player.Image = content

        template.Parent = script.Parent
        template.Visible = true
         end
    end
end)

add

repeat wai() until game:IsLoaded() --just to make sure its loaded
for _,player in pairs(game.Players:GetPlayers()) do
--add "player" to the player list
end

since you only add the player when a new one joins it won’t register players that are already in the game

I tried it but it didn’t work.

I added it but now how it works is when the 2nd player joins it will create the 1st player for the 2nd player AND the 1st player as well. Which means the 1st player sees 2 versions of himself.

any errors? because I need to know why it didn’t worked

it should be in a local script, so it only runs once for the person that joins and not for anyone else

make a check if there’s a player already

It’s already in a local script.

No errors. Works the same as it did before.

then it shouldn’t affect other players, there is no need to send info about already joined or players that join to the server and back. Handle everything on the client.