Hello! This is something I'm not sure what this is called or how to do fix this, but how this works is a gui that appears and dissapears when it is health changed. But seeing that as it continues to be damaged for more than 3 seconds, the gui starts flashing instead of resetting the 3 seconds before disabling the healthbar. How do I resolve this issue? Thanks.
local Humanoid = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Humanoid")
Humanoid.HealthChanged:Connect(function()
script.Parent.Parent.Parent.HealthBar.Enabled = true
script.Parent.HealthNum.Text = math.floor(Humanoid.Health) .. " / " .. math.floor(Humanoid.MaxHealth)
local pie = (Humanoid.Health / Humanoid.MaxHealth)
script.Parent.Healthbar.Size = UDim2.new(pie, 0, 1, 0)
wait(3) -- This part where I want to reset the wait if the function's called or fired again.
script.Parent.Parent.Parent.HealthBar.Enabled = false
end)

1 comment
btw you should do task.wait(3) instead of wait(3)