Despite adding a forcefield, you are still able to lose health, apparently.
local force local on = false script.Parent.MouseButton1Down:connect(function() local player = script.Parent.Parent.Parent.Parent on = not on if on then player.Character.Humanoid.WalkSpeed = 0 force = Instance.new("ForceField",player.Character) else force:Destroy() player.Character.Humanoid.WalkSpeed = 32 end end)
Try saving the amount of health they have when they turn on AFK. Then, when the health changes/repeatedly change their health to the amount that was saved. You will probably want to attach a value to a player/character and store the health in there so that you can change the health later on (also, you might want to put it outside of the connect and use a loop to check if on
is true
and then change the health.