local debounce = false
local dmgPart = script.Parent -- Inside the part
dmgPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if not debounce then
debounce = true
local char = hit.Parent
char:WaitForChild("Humanoid"):TakeDamage(25)
wait(0.2)
debounce = false
end
end
end)
When the part hits me, it sets my health to NaN, making me essentially immortal.
I’ve got no idea why. This just started happening. It was fine b4…
Is it possible for you to do a live demo video here of you playing it to show us that your health is being set to NaN. Since the alternative is just using Health = Health - number
robloxapp-20240703-1740497.wmv (2.8 MB)
here is the video.
You can’t see the log but character health is luckily visible.
I simply created a part and a regular script where I pasted your code:
Hey there,
I have iframe abilities that give the player a forcefield, so :TakeDamage() is required so it does not bypass forcefields. Natural health regeneration is disabled so I have NO idea how this happens.
-- Gradually regenerates the Humanoid's Health over time.
-- pwned ur health regen roblox lolololoo
-- put in startercharacterscripts
local REGEN_RATE = 0/0 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = math.huge -- 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
This script changed humanoid’s hp to NaN whenever it was changed.
Deleting it fixed everything. Thank you!