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

Getting a Username?

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.

3 answers

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

3 comments

0

@iRzPWNzr that wouldnt work. he wants to get the username, but your asking him to input a username

0

Players.Player1.PlayerGui.Backpack.Backpack.Header.Header.L:7: attempt to concatenate global 'playergui' (a userdata value)

0

should be fixed

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

1 comment

0

Someone already answered.

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.

1 comment

0

That only cache's if the player has "InsertPlayerNameHere" i want it to get the actual players name.

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