Check if Player Exists

So the user typed a username in a text box. How do Isee if its an existing player?

2 Likes

Connect something like this to a remote function

    if not Players:FindFirstChild(Text) then
        --plr isnt in game
    end
4 Likes
local Players = game:FindService("Players")

local playerToFind --Direct the textbox here

for i,v in pairs(Players:GetChildren()) do
 if v.Name == playerToFind then
  print("Player Found!")
 end
end

This searches through all the players, should work, just direct the playerToFind variable up to the TextBox.

2 Likes