Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

2 comments

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

0

No I'd like to be able to call back a LocalPlayer's Username.

1 answer

✓ Accepted answer
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

2 comments

0

No? Setting a local variable in a function causes it only accessible to the function itself?

0

He still showed how to declare the variable properly, which is what the asker wanted.

This discussion is preserved as it was. New answers, comments, and votes are closed.