Hey there!
for some reason, whenever i make the humanoid take damage, it immediately heals it back
script:
while true do
local tor = script.Parent.UpperTorso:FindFirstChild("Fire")
if tor == nil then
task.wait(2)
continue
else
local hum = script.Parent.Humanoid
hum:TakeDamage(6)
task.wait(1)
end
end
It’s because there’s a script in the Character that regenerates the health. In fact, it’s called Health and it can only be seen while the game is running on both the server and the client. Here’s a copy of the script:
-- Gradually regenerates the Humanoid's Health over time.
local REGEN_RATE = 1/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 1 -- Wait this long between each regeneration step.
--------------------------------------------------------------------------------
local Character = script.Parent
local Humanoid = Character:WaitForChild'Humanoid'
--------------------------------------------------------------------------------
while true do
while Humanoid.Health < Humanoid.MaxHealth do
local dt = wait(REGEN_STEP)
local dh = dt*REGEN_RATE*Humanoid.MaxHealth
Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
end
Humanoid.HealthChanged:Wait()
end
To stop the regeneration, simply delete the script from the player’s character.
When I manually delete that script from the workspace and damage the character, the health does not regenerate. Furthermore, the deletion is replicated to the client. How are you removing the script? Code?
If you’re trying to delete the health gen script, just create a new Script called “Health” in StarterCharacterScripts and remove all of the code inside.