Hello, :GetPlayers for each client shows that they are the first player

So Im making a spectating gui, and when I do :GetPlayers() for each client they are the first in the table, so player2 is first in there table. Is there a way to eliminate this?

script.Parent.Front.Activated:Connect(function()
local AllPlayers = game.Players:GetPlayers()

print("first player really is ".. AllPlayers[1].Name)

local MaxIndex = #AllPlayers

local CurrentIndex = GetCurrentPlayerIndex()
	
if CurrentIndex + 1 <= MaxIndex then
	Camera.CameraSubject = AllPlayers[CurrentIndex + 1].Character.Humanoid
	print("The next player is ".. tostring(GetCurrentPlayer()))
else
	Camera.CameraSubject = AllPlayers[1].Character.Humanoid
	print("The camera has been reset to first player, who is ".. tostring(GetCurrentPlayer()))
end

NameShower.Text = GetCurrentPlayer().Name

end)

Why not just start at 2? Or even remove the local player from the table?

local AllPlayers = Players:GetPlayers()
table.remove(AllPlayers, Players.LocalPlayer)

yah but If I removed the localplayer from the table it would never show him. this is a spectating gui

But you were just complaining that you didn’t want them to be there first? And why would someone use a spectate feature to spectate themselves when they already can without it?

1 Like