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 3 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
3 years ago
Edited 3 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 — 3y
Ad
Log in to vote
0
Answered by 3 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 — 3y

Answer this question