So I'm trying to make a AFK GUI that only works if the health is at 100. If the health is at 100 it changes the players health to 9999, and removes the players tools. It then has a 60 second countdown and after the 60 seconds it give back the tools and changes the health back to 100.
if game.Players.LocalPlayer.Character.Humanoid.Health == 100 then function action() game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 9999 game.Players.LocalPlayer.Character.Humanoid.Health = 9999 game.Players.LocalPlayer.Backpack.Clean:Remove() wait(0.1) local time = 60 for i = 1, 60 do wait(1) time = time - 1 script.Parent.Text = tostring(time) end game.Players.LocalPlayer.Character.Humanoid.Health = 100 game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 9999 game.Lighting.Tools.Clean:Clone().Parent = game.Players.LocalPlayer.Backpack end end script.Parent.MouseButton1Click:connect(action)
Your question was already previously posted with an answer on it.
Literally, a duplicate of this script.