Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Grab the name of the player that clicked the GUI button?

How do I get the name of the player that pressed a GUI button. Doesn't seem to hard I just need help. I want the player's name stored in a variable.

1 comment

0

You should be using a LocalScript when working with GUI's and since a LocalScript is client-side, you always have that players name.              game.Players.LocalPlayer.Name

1 answer

ScreenGui > TextLabel and a Text Button LocalScript Inside TextButton

TextLabel = script.Parent.Parent.TextLabel
script.Parent.MouseButton1Click:connect(function()
-- script here example
p =  game.Players.LocalPlayer
p.Character.Torso.Anchored = false
TextLabel.Text = p.Name

end)




This discussion is preserved as it was. New answers, comments, and votes are closed.