Is there a way to provide player from click detector?

is there a way to sat who clicked a click detector? does it work like this :

ClickDetector.MouseClick:Connect(function(plr)

7 Likes

i am pretty sure the ClickDetector already passes the player argument when it is clicked, so if you were to do something like this:

ClickDetector.MouseClick:Connect(function(plr)
  print(plr.Name) --- the players name should print
end)
15 Likes

i just tried it , plr is plr.Name

1 Like

Yes, player is a valid parameter. It will give you the player that clicked the ClickDetector. I assume that’s what you were asking for. :slight_smile:

However, if you mean to get the player’s name, you would have to do something similar to:

local pName = player.Name -- gives you the player's name

Are you saying plr and plr.Name return the same thing?(i’m not sure what you mean), plr is the actual player( as an instance) and plr.Name gives you the Name of the player

Just gunna back this up: They do not return the same thing.

As stated, player in this case is the player found ingame.players.

Player.name is the name of the player found in game.players