Slow health loss

Hey…So most of you prob might know like yk a fire block you walk on it you catch on fire it makes you lose health slowly until a certain amount of time…yeah well that how do I do it? I tried making a for loops from player’s health to lose a certain amount but it didn’t work. It sounds so easy and simple but yeah can’t figure it out

Something like:

for 1, 10, 1 do
humanoid.Health = humanoid.Health - 1
end
1 Like

Typically there is a Script within your StarterCharacter that Handles your health Called: Health, if you name a script Health and Place it within StarterCharacterScripts, it will override the Script so you can make a custom health script.

Which this is the Default 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
1 Like

Here’s a starter:

local hotPart = -- [The part's location]

local BURN_DAMAGE = 5
local BURN_DELAY = 3
local BURNS = 10

local burning = {}

hotPart.Touched:Connect(function(otherPart)
    local humanoid = otherPart.Parent:FindFirstChildOfClass("Humanoid")

    if not humanoid or table.find(burning, humanoid) then
        return
    end

    table.insert(burning, humanoid)

    for _ = 1, BURNS do
        humanoid:TakeDamage(BURN_DAMAGE)
        task.wait(BURN_DELAY)
    end

    table.remove(burning, table.find(burning, humanoid))
end)
1 Like