local part = script.Parent
local debounce = false
local function IncreaseMaxHealth(hit)
if debounce then
return
end
if part.Parent:IsA("Accessory") then
return
end
local humanoid = hit.parent:FindFirstChild("Humanoid")
if humanoid then
debounce = true
local CurrentHealth = humanoid.Health
local CurrentMaxHealth = humanoid.MaxHealth
print(CurrentMaxHealth)
if humanoid.MaxHealth >= 100 then
humanoid.MaxHealth = humanoid.MaxHealth + 10
else
humanoid.MaxHealth = humanoid.Health + 10
humanoid.Health = humanoid.Health + 10
while true do
wait(1)
if CurrentHealth <= CurrentHealth - 10 then
CurrentMaxHealth = CurrentMaxHealth - 10
end
end
end
end
end
part.Touched:Connect(IncreaseMaxHealth)
Lets say you had an max health of 120. i put a print code to print max health but apparently no matter what max health you have, it always counts your max health as 100.
and another question i have is
while true do
wait(1)
if CurrentHealth <= CurrentHealth - 10 then
CurrentMaxHealth = CurrentMaxHealth - 10
end
for now im making it a while true loop just to even make sure it works AND it doesnt. Im really stumped and I know i’ve probably made a mistake somewhere here but i dont know where.