local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
player.Character.CerealBox.Activated:Connect(function(player)
mouse.Button1Down:Connect(function()
while player.Character.Humanoid.Health < 100 do
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 20
wait(5)
end
end)
end)
lol, thanks although I thought that activated was when u had the tool equipped. Sorry for the confusion. The original script works or yours does as well.
If this is a local script then any changes made to the player’s humanoid’s health property will not reflect to the server.
local tool = script.Parent
tool.Activated:Connect(function()
if not tool.Enabled then return end
local character = script.Parent
if not character then return end
local humanoid = character:FindFirstChildOfClass"Humanoid"
if not humanoid then return end
if humanoid.Health <= 0 then return end
humanoid:TakeDamage(-humanoid.MaxHealth) --Negative value adds health.
tool.Enabled = false
task.wait(3)
tool.Enabled = true
end)