local Player = game.Players.LocalPlayer
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name == Player.Name then
warn("same name! " .. v.Name .. " and " .. Player.Name)
return
else
warn("different name!")
end
end
This code is ran on a local script, but it says the only player there is the local player? https://imgur.com/5hGeAYA

5 comments
So you're the only actual person in the game...?
You're getting a table of players "game.Players:GetPlayers()" and checking for the LocalPlayer's name.
No there is 2 people in the game
The local player is also a part of the table retrieved when you collect all the players. You have a return inside the if statement, so as soon as you find the local player (and you will), it'll stop the for loop and not search for any other player in the table.
Also, return is used exactly as it sounds: it is used to return data to whatever called it (usually used for fuctions,modules etc..). Use break if you wish to instantly stop a loop from executing any further.)