textButton = script.Parent textButton.MouseButton1Down:connect(function() print "Hello there"..username.."." end)
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
Marked as Duplicate by TheeDeathCaster and Perci1
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?