Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Im trying to make a AFK Gui, but if the health is below 100 it still works?

Asked by
roudgy 0
8 years ago

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)

0
Add the if statement inside the function xuefei123 214 — 8y
0
Never define a function within anything. Flip the function and the if statement. GoldenPhysics 474 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Your question was already previously posted with an answer on it.

Literally, a duplicate of this script.

Ad

Answer this question