Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by
Bman8765 270 Moderation Voter
9 years ago

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.

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 SirNoobly 165 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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)




Ad

Answer this question