plr = game.Players.LocalPlayer name = plr.Name
print() -- Number of letters in a player's name
plr = game.Players.LocalPlayer name = plr.Name
print() -- Number of letters in a player's name
Names are a string, and strings can be manipulated in various ways. The easiest way to get the length of string is to use the string.len(str) function. It can be used two ways:
string.len("Hello World!")
("Hello World!"):len()
In order to get the length of the name of a player, simply do this:
plr = game.Players.LocalPlayer
print(string.len(plr.Name))
It's that simple!
For more information, click here: String Manipulation
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Very good answer.
A shortcut is the
#unary length operator.#plr.Nameis the same asplr.Name:len()@Blue I never knew that, thank you.