How to check player.Name

How can I get the player name on the Client.

Hello I want get the player.Name but how?

This is what I have been created untill now:
This is Client

local Player = game:GetService("Players")
        	    local playername = plr.Name
            	for i = 1, #Player do
            		if playername == #player then
            			print("hi")
            		end
            	end
1 Like

Get the player humanoid first then do player.DisplayName

You could do like:

for i, v in pairs(game.Players:GetPlayers()) do
         if v.Name == "theusername" then
                print("Hello world")
       end
end
6 Likes
if player.Name == "Name here" then

but if you wanna loop through every player

for i, v in pairs(game.Players:GetPlayers()) do
  if v.Name == "Name here" then
   -- do code
  end
end
2 Likes

but when I want the name of the Humanoid how I do that?

player.Character.Humanoid.Name
2 Likes
for i, v in pairs(game.Players:GetPlayers()) do
  if v.Name == "Name here" then
          local humanoid = v.Character.Humanoid


  end
end
1 Like

But doesnt I need waitforchild?

Noticed the question wasn’t read or was misunderstood by alot of people.

If you want the player’s name on the client or through a localscript, it’s pretty simple.

local Player = game.Players.LocalPlayer
local PlayerName = Player.Name

print(PlayerName) -- Will print the player's name.

And if you want the humanoid’s name, this code will work.

local Player = game.Players.LocalPlayer
local Humanoid = Player.Character.Humanoid
local HumanoidName = Humanoid.Name
local PlayerName = Player.Name

print(PlayerName) -- Will print the player's name.
print(HumanoidName) -- Will print Humanoid name.

Unless you change it, humanoid’s name will always be “Humanoid”.

2 Likes

you could do

repeat wait() until player.Character

local char = player.Character

print(char.Humanoid.Name)
1 Like

I will post in 20minits a new post. Then I will understand a new whole problem. I thought if somoene could help me I could fix but no. It needs to be a new post