I have a textbutton on an object in the world which I'm binding MouseButton1Clicked events to. How do I tell who clicks it?
As the SurfaceGui
wiki page says, SurfaceGuis must be descendants of PlayerGui in order to know the player who is interacting with it.
Your best bet would be to put the GUI inside of each player's PlayerGui
, and set the Adornee
to the original object.
Hope this helped.
-- Wherever your text button is workspace.TextButton.MouseButton1Down:connect(function(Player) local PlayerName = Player.Name end)
That code will give you the name of the player who clicks the button.