Humanoid:TakeDamage() is being inconsistent

When I use Humanoid:TakeDamage() the damage on only players becomes inconsistent after the 1st or 2nd use of :TakeDamage().

NPC Damage
image

Player Damage

FireServer

--In localscript inside StarterPack
DamageEvent:FireServer(EnemyHumanoid,20) --EnemyHumanoid, Damage(20)

OnServerEvent

--In serverscript inside ServerScriptService
DamageEvent.OnServerEvent:Connect(function(Player,EnemyHumanoid,Damage)
	local HitDebounce = false
	if not HitDebounce then
		--Hitcount += 1
		--print("Damage: "..Damage)
		EnemyHumanoid:TakeDamage(Damage)
		--print("Hitcount: "..Hitcount,"Enemy Health: "..EnemyHumanoid.Health)
		HitDebounce = true
	end
end)

I have looked around the DevForum and the RobloxAPI Docs, so unless I have missed something, What am I doing wrong?

1 Like

try putting hitdebounce out the onserverevent and make sure to set it false

You should NEVER send instances over remotes! Sometimes, the instance will just not exist on the server, so anything the server does with the thing passed will just be invisible. Also, an exploiter could just…

DamageEvent:FireServer(EnemyHumanoid, 99999999)

And kill any enemy instantly.

2 Likes

They’re probably recovering their health.


@Judgy_Oreo Sending instances over to the server isn’t bad practice.

3 Likes

This should be the answer, I totally forgot players automatically regenerate health. I’ll test it out just to be sure, thank you.