Player.Idled not working?

I have been using the code below, and after being Idle and not on the Roblox window for well over 5 minutes, it still has not printed anything. Am I doing something wrong?

local player = game.Players:WaitForChild("Volieb")
	print("Time: "..seconds)

Note: I am not doing this in Roblox Studio, I am doing it via the Roblox client.

1 Like

I feel like this might just come down to the case that Idled is unreliable to be using. Luckily, there is a way to keep track of it the player is Idle by keeping track of their inputs via UserInputService.

local idle = false
local timer  = 0
      idle = true
      while wait(1) do
            timer += 1
            if not idle then
            if timer >= 180 then
               localPlayer:Kick("Been afk for 3 minutes")
      idle = false
      timer = 0

Probably more friendlier ways to handle this than through a while loop, but you can see the basic principles.


Well, I wouldn’t want to handle it throught the client. I am making this for a hotel game, and I am tyring to kick staff if they go AFK for over a certain amount of time, due to people staying AFK just to have their activity boosted. So, this could be easily bypassed since it is on the client.

Idled probably would be open to the same flaws. I would imagine setting up a macro to emulate a button press would fool both systems.

I just tested it in studio, with both a server and local script. Only the local script picked up that the client was idle for 2 minutes.

1 Like

Gottya, I guess I will just use Idled but through the client. I don’t think it is that big of a deal if someone bypasses it somehow. Thank you for your help!

You could check if there is no input coming from the player for a certain amount of time and then kick them.

You could do this by starting a countdown everytime there is no input on the client via a local script and resetting the countdown everytime the presses anything on their keyboard or moves their mouse, the only way to get around this would be using an exploit, which I assume your "workers’ would not use.

The Question is what is considered as an Input if its for Example a Clicking game and the Player has an Autoclicker. Is it Considered as an Input!

And also i have been Looking for AFK Kick Prevention. Does anybody have something on that Topic???

Add more complexity to your game, this seems more like bad game design if the game is just a clicker game.