I have tested, and tried different ways of trying to detect if a Player is Idle, but, sadly, to my surprise, the code works, but, it does not work after second execution of the chunk, and because of this, I am clearly confused. Sadly I can not provide Output, because nothing came up, as well as the debugging prints
stopped, well, printing after the first execution of the chunk. Here is the code I am currently using;
repeat wait() until game.Players.LocalPlayer local plr = game.Players.LocalPlayer; repeat wait() until plr.Character and plr.Character:FindFirstChild("Torso") local torso = plr.Character.Torso; local chkPosEvery = 1/13.37; repeat local firstPos = torso.Position.X --Yes, I've tried 'CFrame', and Regular 'Position', but this seemed to detect it better wait(chkPosEvery) if torso.Position.X == firstPos then if plr.Character:FindFirstChild("ForceField") then return false, print("ForceField already existant, don't spam") end local FF = Instance.new("ForceField",plr.Character) print("I redeem you AFK") else print("You are no longer AFK") for i,FF in pairs(plr.Character:GetChildren()) do if FF:IsA("ForceField") then FF:Destroy() end end end until nil
Replace "repeat" with "while wait(1) do"
and "until nil" with "end"