textButton = script.Parent textButton.MouseButton1Down:connect(function() print "Hello there"..username.."." end)
COMMUNITY QUESTION
I have this script to say "Hello there PLAYERNAME." but can't get it to work?
1 answer
Simple, you just need to get the player's name.
Since this is a text button (A GuiObject), it's best if you use a LocalScript.
IF you use a LocalScript, you can just get the username like so:
local username = game.Players.LocalPlayer.Name
LocalPlayer is a 'local property' of the Players service. It can ONLY be accessed by LocalScripts and it returns the Player object the LocalScript is running on.
Name is a property of every instance in the Roblox API. It is, simply, the name of the Instance. Player objects are always named after their player's username, so it can be used to get a player's username. Simple.
~coo1o
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
It's best if you enter code in a Lua Block.
Sorry man! I mistaken-ed your Question for another! I'm so sorry! I feel so bad! D: