Say I wanted to use a player's name in a script, but obviously won't know the name of them how would I do it? Would I have a variable that is equal to the player's name who touched the part?
COMMUNITY QUESTION
How would I find a PLAYERNAME?
1 answer
There are multiple ways of finding the player's name.
This script is a normal script:
script.Parent.Touched:connect(function(player)
print(player.Parent.Name) --This would print the name of the person who touched the brick
end)
For LocalScripts, its 1 line of code.
game.Players.LocalPlayer.Name
eg (LocalScript)
print(game.Players.LocalPlayer.Name)
--> Output: Player's Name
I hope that I've answered your question :D
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Where would said local script go in the player?
What do you mean?