[Super Tip] This is why your Server Script aren't changing the HP of the Humanoid!

Today I discovered something that almost broke my mind…

I did a kind of Death system that run a animation and etc… but when I was scripting the respawn system by some random reason I found that my script aren’t changing the humanoid Health.

So, after almost 2 hours scripting and failing… I discovered that if you character health fall to 0.

The code:

Humanoid.Health = Value

Didn’t will work.

So in your Damage System make the min value that your humanoid can be to 1.

Example:

local DamageNumber = 10

local Humanoid = Character:FindFirstChild("Humanoid)"

if Humanoid ~= nil then
   if Humanoid.Health - DamageNumber < 1 then
      Humanoid.Health = 1
   
   else 
      Humanoid.Health = Humanoid.Health - DamageNumber
   end
end
1 Like

Sure, you could do that… But there’s also an event called “Humanoid.Died”

This post should be moved to #help-and-feedback:scripting-support where you can get assistance for your scripting needs. #resources:community-tutorials is quite self-explanatory.

This is in the correct category due to it providing a tip for others to use.

Scripting support is for people who need help with scripting, and this topic does not fit the criteria for #help-and-feedback:scripting-support since the topic isn’t asking for help.

1 Like