Help with Player.Name in a text

i am having trouble with this script,

script.Parent.Text = ""..Player.Name..""

I am trying to make it so whenever the user joins the game their username pops up.

What script type is it? Where is it located? By the way, the concatenating of empty strings is unnecessary, Player.Name is already a string.

script.Parent.Text = Player.Name

it is a local script under a text label,

local Players = game:GetService("Players")

script.Parent.Text = ""..plr.Name..""

If your going to have an empty "", then why have it in the first place? You could just do

script.Parent.Text = Player.Name

If your intent is to have “acuaro” (I just wrote my name in there as an example) then you’d need to do a different way as it would interpret that as

" -- Start of string " -- end of string

You also need to make sure your defining the player right :slight_smile:

There is your problem, plr is not defined.

local Players = game:GetService("Players")
local client = Players.LocalPlayer -- I prefer naming the variable client, but use player if you want

script.Parent.Text = client.Name

Works on my machine

3 Likes