I was trying to fix a script for a friend of mine, but I'm having some issues.

local health = 10
local active = false

script.Parent.Equipped:Connect(function()
	active = true
end)
script.Parent.Unequipped:Connect(function()
	active = false
end)
while wait(1) do
	if active and script.Parent.Parent.Humanoid.MaxHealth >= script.Parent.Parent.Humanoid.Health then
		script.Parent.Parent.Humanoid:TakeDamage(health * -1)
	elseif active and script.Parent.Parent.Humanoid.MaxHealth - script.Parent.Parent.Humanoid.Health < 10 then
		script.Parent.Parent.Humanoid:TakeDamage(script.Parent.Parent.Humanoid.MaxHealth - script.Parent.Parent.Humanoid.Health)
	end
end