How do i make a stringvalue's value appear on a nametag

Is this the right script for finding the stringvalue in a player then getting that and if that value matches then their name tag will change?

if player.EquippedTitle.Value == "Beginner" then
			if char.Head:FindFirstChild("BillboardGui") then
			else
				lowertext.Text = "Beginner" --This is that the text will say.
				lowertext.TextColor3 = Color3.fromRGB(103, 24, 245) --This is what the color of the text will be.
			end
		end

``

Can you show the full script? I need to see more

--Variables
local rep = game:GetService("ReplicatedStorage") 
local nametag = rep.NameTag 

--functions
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		--Varibles
		local head = char.Head
		local newtext = nametag:Clone() --Cloning the text.
		local uppertext = newtext.UpperText
		local lowertext = newtext.LowerText
		local humanoid = char.Humanoid

		humanoid.DisplayDistanceType = "None"

		--Main
		newtext.Parent = head
		newtext.Adornee = head
		uppertext.Text = player.Name --Changes the text to the player's name.

		  if player.EquippedTitle.Value == "Beginner" then
			if char.Head:FindFirstChild("BillboardGui") then
			else
				lowertext.Text = "Beginner" --This is that the text will say.
				lowertext.TextColor3 = Color3.fromRGB(103, 24, 245) --This is what the color of the text will be.
			end
		end
	end)
end)

Why is there an else statement with nothing before it?

should i remove the else statement?

if char.Head:FindFirstChild(“BillboardGui”) then should be

if char.Head:FindFirstChild(“NameTag”) then, because local nametag = rep.NameTag

Yes. Remove the else statement.

but isn’t it a billboardgui? ?

The name of the BIllboardGui is NameTag. But if you wanted you could do if char.Head:FindFirstChildOfClass(“BillboardGui”) then, but if you added another billboard gui it wouldn’t work so I recommend if char.Head:FindFirstChild(“NameTag”) then

Alright should i try it right now?

Remove the else statement, and yes.

hm thats strange, when i equipped a title, the nametag value didn’t change to beginner

I mean the value changed but the nametag itself didnt

Make an EquippedTitle.Value changed function:
player.EquippedTitle.Changed:Connect(function()
if player.EquippedTitle.Value == “Beginner” then
if char.Head:FindFirstChild(“BillboardGui”) then
lowertext.Text = “Beginner” --This is that the text will say.
lowertext.TextColor3 = Color3.fromRGB(103, 24, 245) --This is what the color of the text will be.

– then put the end statements or whatever will close the script

How many ends do i add because when i added the ends it said an error

You could try making a new script and add the nametag when the player joins:

–Variables
local rep = game:GetService(“ReplicatedStorage”)
local nametag = rep.NameTag

–functions
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
–Varibles
local head = char.Head
local newtext = nametag:Clone() --Cloning the text.
local uppertext = newtext.UpperText
local lowertext = newtext.LowerText
local humanoid = char.Humanoid

	humanoid.DisplayDistanceType = "None"

	--Main
	newtext.Parent = head
	newtext.Adornee = head
	uppertext.Text = player.Name --Changes the text to the player's name.

	  player.EquippedTitle.Changed:Connect(function()
		if char.Head:FindFirstChild("NameTag") then
			lowertext.Text = player.EquippedTitle.Value --This is that the text will say.
			lowertext.TextColor3 = Color3.fromRGB(103, 24, 245) --This is what the color of the text will be.
		end
	end
end)

end)

actually never mind i got the ends

Does it work? If not I might have a solution

yeah, it still doesn’t work :frowning:

Did you already try the post 16 solution?