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

Getting player username using a script?

Asked by 4 years ago

In my script, I need to get the player username in able for it to work. How would I get a player username using a script? And how do I apply the name, to like a variable? Ex:local Car = workspace.playersusernamesCar

2 answers

Log in to vote
0
Answered by
Omzure 94
4 years ago
Edited 4 years ago

if you want to know how to do it with a normal script, here you go:

game.Players.PlayerAdded:Connect(function(player)
    print(player.Name)
end)
0
/\ do this mine was probably with local scripts srry xd sean_thecoolman 189 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I usually get usernames through this path:

game.Players.LocalPlayer.Name

It is much easier to do it through the Players thing rather than Workspace.

Once you get it through there, you can set a variable for it.

Local name = game.Players.LocalPlayer.Name
0
This is for a local script right? I need it to work with a regular script. mcslimeman 37 — 4y

Answer this question