My script not working for nametag

Hello
I’m trying to create a name tag but my script is failing so when I try it the name tag doesn’t appear,and i need solution with my script

And this is my script

local rep = game:GetService("ReplicatedStorage")
local nametag = rep.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 == "DeV_VcR" then
			lowertext.Text = "Owner"
			lowertext.TextColor3 = Color3.fromRGB(3, 251, 255)
	end)
end)


NameTag
This is what i want
MyNameTag
And This is when i test in game and its doesn’t appear

1 Like

I’m not sure whether this was a copy paste mistake or not, but you are missing an end here.

2 Likes

and what i must to do? do you have solution?

1 Like

well I though it was easy to understand. Just add an end afterwards like this:

	if player.Name == "DeV_VcR" then
		lowertext.Text = "Owner"
		lowertext.TextColor3 = Color3.fromRGB(3, 251, 255)
	end--here is the end I added.
1 Like

Are you sure that the BillboardGui property Enabled is on? This could be the issue if this property was off.

1 Like

i changed it but still not work ;-; do you have any solution?

1 Like

Do you have any frames’s visibility to off? This could also be one of your issues If the gui was hidden/invisible.

1 Like

i did
BillBoard

1 Like

maybe put capitals like LowerText not Lowertext
ROBLOX lua is very sensitive with every letter and it must be in correct capitals otherwise it doesnt read it and it wont work

1 Like

what is that i dont know my frame’s visibility are off or on
i am new scripting

1 Like

Refer to Frame’s visible property

1 Like

i just chaged it and test it again but still not work
image

2 Likes

image

1 Like

The only problem is with the Frame objects. Are their Visible property turned off? If so, turn them on. That’s the cause of making the GUI look invisible and hardily seeing them.

1 Like

image

1 Like

This doesn’t really look like a problem with your script, to me. Except you are missing an end for the statement

if player.Name == "DeV_VcR" then

But except that I want to ask you for some other things to check:

  1. Check that the UI is cloned into the character
  2. Check for any errors in the Output console
  3. You might be zoomed too out, I mean like there is a property of max distance for Billboard UIs, so try increasing it or something
2 Likes

Actually, would like to ask you if the code that you have there is placed in the ServerScriptService & in a script or not, as you seem to be a beginner scripter, it can be a confusion to you.

2 Likes

s I think I know what’s the problem now. There should be a :WaitForChild on the character’s head. I see how the script wants to insert the GUI instantly when the character’s added onto the game. What happens is that if the head isn’t included in the character when it’s added onto the workspace, the script will return an error. The script must wait for the head to be added in the character model; therefore, the GUI should appear adequately without issues.

local head = char:WaitForChild"Head"
1 Like

this is same or different?
image

1 Like

char.Head is different. The script is attempting to find the character’s head once the character added fired with the character. char:WaitForChild"Head" would wait for an object named “Head” to be added, returning the found awaiting object.

I was once having this similar issue when I was making custom nametags.

4 Likes