Custom Playerlist working incorrectly

I made a playerlist and I’ve never scripted one before so I’m kind of new to it.
For some reason it works for the first player but not for the next ones as you can see in this video.
Here is my script

	local PlayerGui = NewPlayer:WaitForChild("PlayerGui")
	local MainGui = PlayerGui:WaitForChild("MainScreenGui")
	local MF = MainGui:WaitForChild("AllFrame")
	local List = MF:WaitForChild("PlayerMenu")
	local There = false
	for i,P in pairs(game.Players:GetPlayers()) do
		for i,Lab in pairs(P.PlayerGui.MainScreenGui.AllFrame.PlayerMenu:GetChildren()) do
			if not game.Players:FindFirstChild(Lab.PlayerName.Text) then
				if Lab.PlayerName.Text ~= NewPlayer.Name and not game.Players:FindFirstChild(Lab.PlayerName.Text) then
					if There == false then
						There = true
					Lab.PlayerName.Text = NewPlayer.Name
					if Lab.PlayerName.Text ~= P.Name and not game.Players:FindFirstChild(Lab.PlayerName.Text) then
					Lab.PlayerName.Text = P.Name

There’s not enough information in this thread (chiefly where your script is in the hierarchy) so I’m going to make a lot of assumptions when I say what could be or is wrong with this.

The first is that if this isn’t a LocalScript, then you should make it one, never use regular scripts to work with Guis. If this already is a LocalScript, then that leads into my second point: that LocalScript should only be updating the leaderboard for itself, not for other players as well. A LocalScript cannot propagate changes to other clients so they will not see any updates.

The best result, to reiterate, is to have a LocalScript only updating the leaderboard for itself rather than for everyone else.

Ahh, That makes a lot of sense now that I think about it. Ill definitely rework it with a local script and only change it for the lp’. Thank you!