Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you temporarily stop regen Health when damaged?

Asked by 1 year ago

all answers are appreciated

1 answer

Log in to vote
0
Answered by
VAnkata20 135
1 year ago
Edited 1 year ago

I looked at your question and got interested myself and I made the code for that. here it is

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local CurrentHealth = Humanoid.Health
local HealthScript = Character:FindFirstChild("Health")

Humanoid.HealthChanged:Connect(function(health)
    if CurrentHealth > health then
        HealthScript.Disabled = true
        wait(3) 
        HealthScript.Disabled = false
    end
CurrentHealth = health
end)

Put it in StarterCharacterScripts and you done . now the player needs to wait 3 seconds before healing appears

0
Thank you! Torekalanae 2 — 1y
0
no problem :) VAnkata20 135 — 1y
Ad

Answer this question