Im trying to make it for when a person clicks a button in a GUI, there name will appear in the Frame.
✓ ANSWER ACCEPTED
How can I get a TextLabel to display the person who clicked a button?
2 answers
✓ Accepted answer
The person said they wanted a TextLabel to display the player's name, not the button that gets pressed!
local textlabel = somelabel
local button = thebutton
button.MouseButton1Click:connect(function(player)
textlabel.Text = player.Name
end)
If you want it to display on a public server GUI, you probably wanna do somethin' like this
GLOBAL:
local textlabel = somelabel
local clickedEvent = game.ReplicatedStorage.clickedEvent -- You have to add a RemoveEvent to Replicated Storage
local players = game.Players
clickedEvent.OnServerEvent:connect(function(plr)
plrchild = players:GetChildren()
for i,v in pairs(plrchild) do
local plrGUI = v:FindFirstChildOfClass("PlayerGui")
textlabel = wherevertextlabelisinsideplayerGUI
textlabel.Text = plr.Name
wait()
end
end)
LOCALSCRIPT:
local button = somebutton
local clickedEvent = game.ReplicatedStorage.clickedEvent
button.MouseButton1Click:connect(function()
clickedEvent:FireServer()
end)
local playerValue = nil
local textbutton = script.Parent
textbutton.MouseButton1Down:Connect(function(player)
playerValue = player
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Use the MouseButton1Down event and change the player's name in it
I'm a bit confused when you say "Change the players name in it" What do you mean, I already have the MouseButton1Down event.
I meant change the GUI's text