How can i destroy() a specific "value" with a LocalScript

Hi, I’ve been trying for a while to find a way to destroy a value (I don’t think this is the right term but). I made a script (which is below) to create a NameTag except that because of this, the player sees his name in addition to the others (picture). I was advised to destroy the value (thirdtext) with a localscript so that the player doesn’t see his name anymore but still sees the other players’ names. The problem is that I tried a lot of localscripts without success. If someone has an advice or a solution it would be nice. Thanks

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		Clone.Parent = game.Workspace:WaitForChild(plr.Name).Head
		local head = char.Head
		local newtext = nametag:Clone() 
		local uppertext = newtext.UpperText
		local secondtext = newtext.SecondText
		local thirdtext = newtext.ThirdText
		local humanoid = char.Humanoid
		local wolves = Instance.new("IntValue")
		humanoid.DisplayDistanceType = "None"

		while wait() do
		wolves.Value = plr:WaitForChild("leaderstats"):FindFirstChild("Wolves").value

		newtext.Parent = head
		newtext.Adornee = head
		secondtext.Text = "/90"
		uppertext.Text = wolves.Value
		thirdtext.Text = plr.Name -- THIS IS WHAT I WOULD LIKE TO DESTROY
			if uppertext.Text == "90" then 
				uppertext.TextColor3 = Color3.fromRGB(49, 153, 26)
				secondtext.TextColor3 = Color3.fromRGB(49, 153, 26)
			end
			
	end
  end)
end)

Try using nametag.PlayerToHideFrom = Player (Replace Player with your LocalPlayer Instance) This should make it disappear for you and for the other Players. (It’ll only hide their Billboards in this case)

Or, If you are running this on a ServerScript, Simply make the PlayerToHideFrom Property the Player that has just joined.

1 Like

Thank you for your answer. However, I can’t seem to apply your advice. I must be doing it wrong
2

LocalPlayer can’t be accessed from the Server. Are you running this on a Server Script or in a Local one?

Can’t you still refer to the player?

Yes I know, the first script is applied on a serverscript. The second script (the one i posted just now) is ont local script in StarterCharacter

Since your nametag billboard gui is cloned and parented to the character’s head by the server,
you can delete it locally with a localscript

local player = game:GetService("Players").LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")

Head.newtext.thirdtext:Destroy()

player.CharacterAdded:Connect(function(newcharacter)
   Head = newcharacter:WaitForChild("Head")

   Head.newtext.thirdtext:Destroy()
end)
1 Like

Thank you for your help. Unfortunately, I can’t place your script correctly to make it work

Where are you placing the script? You can try to place it in startercharacterscripts so it’s easier to define the character and so you can remove the characteradded event

1 Like

Unfortunately I can’t make it go away despite my best efforts. I don’t doubt that your script is good, I think I must be doing something wrong. Thank you for your time

1 Like

Your main problem is that you are generating new GUI. If there is a way to find this gui for every player you could do…

wait(1)
TheGUIhere.enabled = false -- to there is no way to delete a function i think

in a local script

Edit: Find players head!

Head.thirdtext.enabled = false -- in a local script this would make the text dissapear
1 Like

Thank you for your answer. Do you know what error I make in this script? The localScript is located in StarterCharacterScripts

local player = game:GetService("Players").LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
local rep = game:GetService("ServerStorage")
local nametag = rep.NameTag 
local thirdtext = nametag.ThirdText


Head.thirdtext.enabled = false

Isn’t there something I could do in the very first script at the top to make the players’ names visible without having to add them manually? Because even with this addition, the magnification of the names is no longer done when the days are far from each other. So it is difficult to read the names of the players without getting close. While there are basic magnifications and re-sharpenings according to the distance of the players