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

How do I make a player's name appear on a TextLabel?

I tried using this script but I feel like it's outdated.

script.Parent.Text = game.Players.LocalPlayer.Name

I don't know what I'm doing wrong, do I have to change the code or set the TextLabel's name to something else?

3 answers

if ur using a script you need at least a remoteevent or something that returns the players name if ur using a localscript ur code is perfect

--hab a good day

You need to put this code in a localscript since it is the only type of script that can access PlayerGui and the Player itself.

local player = game.Players.LocalPlayer
while wait() do
	script.Parent.Text = player.Name
end

This script will constantly update the label with the player name. Let me know if it doesn't work.

1 comment

0

I tried putting it in a localscript but it still doesn't work.

What you have to write is

script.Parent.Text = game.Players.LocalPlayer.Humanoid.DisplayName

i went from the script you gave but this should work. i also fixed it from last time but try this!

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