Name tag Disappearing Issue

Hello!
I got an issue with name-tags

In-Studio

image

In-Game

image

There is nothing in code that deletes the hp bar frame

https://gyazo.com/4e0e58177c7bf416a0e6729cbebc89aa
Once I respawn the hp bar frame disappears
(Bug this or no, I really don’t know.)

1 Like

Could you send us the code where you handle the creation of that bar?

Inside bar

wait()

local plr = game.Players.LocalPlayer.Character

local bar = script.Parent.PlayerTag.Health.Bar

while wait() do

bar.Size = UDim2.new(plr.Humanoid.Health / plr.Humanoid.MaxHealth, 0, 1, 0)

end

SSService:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local tag = script.Nametag:Clone()
		tag.Parent = char.Head
		--tag.PlayerTag.Text = plr.Name
		--tag.System.Disabled = false
		--char.Humanoid.DisplayDistanceType = "None"
		--char.Humanoid.HealthDisplayType = "AlwaysOff"		
	end)
end)

Does the tag also include the health bar?

image

Try adding WaitForChild, although this doesn’t seem like it would fix it. Still worth a try

wait()

local plr = game.Players.LocalPlayer.Character

local bar = script.Parent:WaitForChild("PlayerTag"):WaitForChild("Health"):WaitForChild("Bar")

while wait() do

bar.Size = UDim2.new(plr.Humanoid.Health / plr.Humanoid.MaxHealth, 0, 1, 0)

end
1 Like

Also did you try running this without the addons below?

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local tag = script.Nametag:Clone()
		tag.Parent = char.Head
	end)
end)

I marked them --, so no :upside_down_face:

Try disabling the LocalScript. See if the bar disappears after. If so then the problem must be within that local script.

Is already disabled…

I don’t see any causes of this unless there are other scripts that control the healthbar. I just replicated this and It seems that I don’t have any issues: https://gyazo.com/a132468a1cf34455b79932081e1211a9

Also if you’re not aware of this, the healthbar will only replicate at the clients’ side since you’re handling it with the localscript, so other players won’t see any changes.

Consider using this instead on your Server sided script:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		
	    local Humanoid = Character:FindFirstChild("Humanoid")
		Humanoid.DisplayDistanceType = "None"
		Humanoid.HealthDisplayType = "AlwaysOff"	
		
		local tag = script.Nametag:Clone()
		tag.Parent = Character:FindFirstChild("Head")
		tag:FindFirstChild("PlayerTag").Text = Player.Name
        local bar = tag:FindFirstChild("PlayerTag"):WaitForChild("Health"):WaitForChild("Bar")

Humanoid.HealthChanged:Connect(function(NewHealth)
  bar.Size = UDim2.new(Humanoid.Health / Humanoid.MaxHealth, 0, 1, 0)	
end)


end)

end)
1 Like

Sorry for no responding i had to go.

I think thats because of some properties in frame

Try turning off ResetOnSpawn property of the SurfaceGui off if you haven’t. I see nothing wrong with the scripts.