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

nametag script not chancing the textlabels name to the player name?

local NameTag = script.NameAbovehead

game.Players.PlayerAdded:Connect(function(plr)
	print(plr)
	wait(2)
	local PlrName = plr.Name
	local Character = plr.Character
	local Head = Character:WaitForChild("Head")
	NameTag.Name.Text = PlrName
	NameTag:Clone().Parent = Head

end)

ServerScriptService.NameTagScript:9: attempt to index string with 'Text'  -  Server  -  NameTagScript:9

3 comments

0

NameTag doesnt have a Text property in its name. just change from NameTag.Name.Text to NameTag.Text

0

.Name.Text seems recurrent. TextLabel.Name returns the name of Text object. TextLabel.Text returns the value of Text object. Do you mean NameTag.Text?

0

name is a textlabel inside of the billboard gui probbaly should have named that diffrently

1 answer

Make a billboard GUI to your likings and call it UpperText and put It in server storage and make a script in ServerScriptService and this is the script

Don't copy lower text

local ss = game:GetService("ServerStorage")
local nametag = ss.NameTag

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local head = char.Head
		local newtext = nametag:Clone()
		local uppertext = newtext.UpperText
		local lowertext = newtext.LowerText
		
		
		newtext.Parent = head
		newtext.Adornee = head
		uppertext.Text = player.Name
		
		if player.Name == "MattVSNNL" then -- Change mattvsnnl to your name or just delete this
			lowertext.Text = "Owner"
			lowertext.TextColor3 = Color3.fromRGB(0, 99, 148)
		end
	end)
end)

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