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

So basically i made a title shop and a player buys and equips a title. I made a stringvalue to show what they are equipping but when they equip it how do i make it so the stringvalue shows, for ex: they buy a beginner title and that title gets added to their inventory, then they equip it, the name of the title gets added to the stringvalue’s value. How do i make it so that value shows
here is the script if it will be any help



--Variables
local MarketplaceService = game:GetService("MarketplaceService")
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"

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




			if player == player.EquippedTitle.Value then
			if char.Head:FindFirstChild("BillboardGui") then
			else
				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)

I don’t see that you identified the string value. Did you create this script?

im kinda a beginner scripter so i looked on yt to make this script

First you would have to put the text in the string value’s value. A string value should not be located in a player.

where would i put it other than a player?

I would reccomend serverstorage

Once you do that, you are going to need to fix up your script and identify the value’s location.

so should i delete this?

local EquippedTitle = Instance.new("StringValue")
	EquippedTitle.Name = "EquippedTitle"
	EquippedTitle.Parent = player

Yes, make a value yourself, there’s no need to use Instance.new as of right now.

Would that stringvalue apply to everyone in the server? if it was in serverstorage

As of right now, yes it is displaying everyone because you did not identify who has purchased the gamepass. I recommend looking at this tutorial to help you: Roblox Tutorial - How to make and use Gamepasses - YouTube

oh its not a gamepass u buy it with currency in game

local gamepassId = 14178155

Why do you have that there?

uh if not gamepass why is this here

i removed some parts of the script. That was going to be used for something else, i already know how to do it for a gamepass

Can you send your new script please? Ty

alright ill send the new one



--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 == player.EquippedTitle.Value then
			if char.Head:FindFirstChild("BillboardGui") then
			else
				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)

If you are using in-game currency, look at this. It talks about datastores. Roblox Currency Script System Tutorial - Monetise your Game - YouTube

Should help you understand more hopefully.

Alvinblox in that video was only talking about datastores and buying dev products for currency.