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

How do I save a players username to a certain Variable?

Asked by 6 years ago
Edited 6 years ago

So I've come up with. game.Players.ChildAdded.LocalPlayer.Username = N Will this save the Child added's Name to the letter N? So i can call it back? And I've confused myself with how to call it back so How can I call back the username?

Ive changed it actually would it be N = game.Players.ChildAdded.(MaybeLocalPlayer).Username

Is that right?

0
What? This is the most confusing thing ever... So do you want the players name to be Person with an n so it is like Personn or do you want it to be a variable in which it is in? Cause you would do local N = Game.Player.LocalPlayer greatneil80 2647 — 6y
0
No I'd like to be able to call back a LocalPlayer's Username. SpinnyWinny 0 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago
game.Players.PlayerAdded:connect(function(player)
    local N = player.Name
end)

If you are doing it in a LocalScript it would be something like this:

player = LocalPlayer
local N = player.Name
0
No? Setting a local variable in a function causes it only accessible to the function itself? frostysubatomiczero 51 — 6y
0
He still showed how to declare the variable properly, which is what the asker wanted. Goulstem 8144 — 6y
Ad

Answer this question