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

Getting a Username? [closed]

Asked by 10 years ago

I am trying to make a script where it will update the gui to the user's username

username = NEED HELP HERE
player = game.Players.LocalPlayer.PlayerGui
header = game.Players.LocalPlayer.PlayerGui.Backpack.Backpack.Header.Header

if header.Visible == true then
    header.Text = " "..player
end

So i am trying to figure out how to "get" the users username...

Thanks in advanced.

Locked by Thewsomeguy and AmericanStripes

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
3
Answered by 10 years ago
player = game.Players.LocalPlayer
playerGui = player.PlayerGui
username = player.Name
header = game.Players.LocalPlayer.PlayerGui.Backpack.Backpack.Header.Header

if header.Visible == true then
    header.Text = username
end
0
@iRzPWNzr that wouldnt work. he wants to get the username, but your asking him to input a username jbjgang2 37 — 10y
0
Players.Player1.PlayerGui.Backpack.Backpack.Header.Header.L:7: attempt to concatenate global 'playergui' (a userdata value) TwoSlhue 5 — 10y
0
should be fixed jbjgang2 37 — 10y
Ad
Log in to vote
1
Answered by 10 years ago
username = game.Players.LocalPlayer.Name
player = game.Players.LocalPlayer.PlayerGui
header = game.Players.LocalPlayer.PlayerGui.Backpack.Backpack.Header.Header

if header.Visible == true then
    header.Text = " "..player
end

0
Someone already answered. TwoSlhue 5 — 10y
Log in to vote
0
Answered by 10 years ago

Hi, I think this would help:

PlayerToolGUI = game.Players.LocalPlayer.PlayerGui --You can't name something after an official function, so I made it PlayerToolGUI
header = game.Players.LocalPlayer.PlayerGui.Backpack.Backpack.Header.Header

game.Players.PlayerAdded:connect(function(player)
    repeat wait()until player.Character
    if player.Name=="InsertPlayerNameHere" then
    if header.Visible == true then
        header.Text = " "..player
end
    end
end)

Edit away to your desire.

0
That only cache's if the player has "InsertPlayerNameHere" i want it to get the actual players name. TwoSlhue 5 — 10y