Need help with fixing health gui (billboard)

Hello, and I have made health gui, and the problem it’s working with other parts, like killpart or sword, the health really shows, but the problem is with parts, that takes small damage but fast, like in first image.

When health bar is not working

There's when the health bar works

Script for parts, that breaks health bar (local script in StarterCharacterScripts)
for i, v in pairs(game.Workspace:GetDescendants()) do
	if v:IsA("Part") and v:FindFirstChild("DamageCount") then
		local DamageCount = v.DamageCount.Value
		v.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
				local humanoid = hit.Parent:FindFirstChild("Humanoid")
				humanoid:TakeDamage(DamageCount)
				debounce = true
				wait(0.1)
				debounce = false
			end
		end)
	end
end
Script for health bar (Server script in ServerScriptService)
local function round(n)
return math.floor(n + 0.5)
end

newTag.HealthText.Text = round(Humanoid.Health).."/"..Humanoid.MaxHealth

Humanoid:GetPropertyChangedSignal("Health"):Connect(function() 
newTag.Health:TweenSize(UDim2.new(Humanoid.Health/Humanoid.MaxHealth,0,0.2,0),"Out","Back",.25)
newTag.HealthText.Text = round(Humanoid.Health).."/"..Humanoid.MaxHealth
end)

Thanks for your help!

I think the problem is that the script for part is a local script.

If you don’t know, local scripts only run on the client, you only see the changes that happened. Lets say you destroyed a part from a local script, only you would see it.
But for a server script, the whole server(all the clients), can see the changes.

So the script for the part that damage you, only you will see the changes, not the server and the server will think you are still fine.

I’m not sure if you understand my english but I am not really good at english.

1 Like

Yes i understand, but does the script still will work on server?

the script for parts should be placed in a server script so the server will know that you get damaged

Yes i know, i will test it now on server script

Ok thanks, changed local script into server, it works