#heal script not working

15 messages · Page 1 of 1 (latest)

twilit needle
#

local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Humanoid = Player.Character and Player.Character:FindFirstChild("Humanoid")
local HealAmount = 20 -- Change this to adjust the amount of health restored

if not Humanoid then
Player.CharacterAdded:Connect(function(char)
Humanoid = char:WaitForChild("Humanoid")
end)
end

function onActivated()
if Humanoid.Health == Humanoid.MaxHealth then
return -- Don't do anything if already at full health
end
Humanoid.Health = math.min(Humanoid.Health + HealAmount, Humanoid.MaxHealth) -- Add the healing amount, capped at the maximum health
end

Tool.Activated:Connect(onActivated)

after like 2 seconds it reverts back to half health

shut lynxBOT
#

studio** You are now Level 1! **studio

twilit needle
#

alr

#

ty

sand mango
twilit needle
#

it works but every time i take damage i take more
like if i was at 50% healed then took damage agin id be at 40%

#

nvm deads thing worked

#

ty

sand mango
#

If the player takes damage. The health resets to the old health

#

Because local scripts are only client sided

#

So the changes won't be visible to the server

#

@mint oak

#

Take a damage using a server script

#

That will cause your health to be reset

#

Rice head.💀