script.Parent.Fire.OnServerEvent:Connect(function(player)
local Figure = script.Parent
local Head = Figure:WaitForChild("Head")
local Humanoid = Figure:WaitForChild("Humanoid")
-- regeneration
while true do
wait(0.5)
while Humanoid.Health < Humanoid.MaxHealth do
wait(0.125)
Humanoid.Health = Humanoid.Health + 1
end
wait(20)
end
wait(35)
end)
this works on its own but I want it to be on button click not automatic
local Figure = script.Parent
local Head = Figure:WaitForChild("Head")
local Humanoid = Figure:WaitForChild("Humanoid")
-- regeneration
while true do
wait(0.5)
while Humanoid.Health < Humanoid.MaxHealth do
wait(0.125)
Humanoid.Health = Humanoid.Health + 1
end

1 comment
https://developer.roblox.com/en-us/api-reference/event/GuiButton/MouseButton1Click