Disable AFK Kicking

I saw this game called “Kavra’s Kingdom” and they have a room where a player can sit afk for hours without needing any input. Any idea on how this would be possible?

Thanks!

20 Likes

That is unfortunately not possible.

If I remember correctly, you cannot extend or remove the idle kick.

4 Likes

There are games doing it. It’s definitely possible

4 Likes

Let me get this straight: There are games that have removed the 20 Minute Idle Kick?

As far as I know, the only way to do this is with the player using an autoclicker or messing with the CoreScripts, which is restricted to Roblox Staff only.

Can you link one of the games that does this?

2 Likes

Autokick is a built-in function by Roblox. It’s not possible to remove it and there is no way around it, as it requires client to be active as in sending mouse and keyboard inputs. Also this question was asked multiple of times and answer was always the same. No you can’t.

EDIT: yeah actually just teleport the player to a different place

8 Likes

Yep. Its a part of the CoreGui. And only staff can access the CoreGui.

4 Likes

I found this article from 4 years ago, but I doubt the method still works plus it’s quite complicated. https://devforum.roblox.com/t/prevent-afk-timeout/72806
Edit: I don’t think it’s even valid :sweat_smile:

3 Likes

Yes, but I don’t think the solution mentioned there will work because it requires the player to move (by reloading), which defaults the purpose of what the OP is asking for.

I wish that we could extend the limit, but the limit is most likely there for a good reason.

2 Likes

I am pretty sure there is no way to disable the 20-minute AFK kick, due to Roblox not wanting AFK users taking up server space and if you are AFK, as well as premium, you are giving the developer free robux, which could be abused.

4 Likes

I believe the way to do this is moving them to a different place and then teleporting them back right after
Just do that every 19 mins or whatever

I know that is one way people do

6 Likes

This should be possible by teleporting the player to the same game every 15~ minutes, this method does not work for 1 player servers though.

11 Likes

Hmm… You could use raycasting in the same way it is used for region based sounds. But instead of “playing a sound” when the player enters a region and “stopping the sound” when they leave the region you could “enable”/“disable” the localscript below inside their character…

while wait() do
	game:GetService("Players").LocalPlayer.Idled:connect(function()
		game:GetService("VirtualUser"):ClickButton2(Vector2.new())
	end)
end

Edit: This has ben tested and DOES work.

12 Likes

I played the game that was mentioned in this post, Kavras Kingdom, and they actually bypassed the AFK kick by teleporting you back into the game every 15 minutes or so, and then moving your character back into the AFK room (presumably by checking if you were coming from the AFK room before you were teleported).

So I’m assuming it is possible using TeleportService. But I’m not sure if this violates Roblox’s TOS as it is abusing premium payouts somehow? It allows premium users to abandon their computers and stay in your game for up to days on end without actually playing it…

3 Likes

I would like an official way to disable the inactivity kick, right now my users are forced to use auto clickers and such to keep themselves in my game Power n Chill. Which is a somewhat idle based game. I will look into this teleportservice trick and see if it works after detecting inactivity from the client.

In regards to “premium” payouts if it could already be “gamed” with someone using an autoclicker I don’t think it is a good reason to not be able to disable this. Maybe more checks from Roblox that there is an active user in their own client would be better. Though I suspect Roblox is already detecting if input is simulated or not and ignoring it for such things, which means they have “soft support” for not getting kicked already.

To encourage different game types like Power n Chill in Roblox you can’t have a typical blanket kicking out of users due to “inactivity”.

2 Likes

Server

local RejoinRemote = Instance.new("RemoteEvent")
RejoinRemote.Name = "RejoinRemote"
RejoinRemote.Parent = game.ReplicatedStorage

RejoinRemote.OnServerEvent:Connect(function(Player)
	local teleportData = {
		autoRejoin = true
	}

	local teleportOptions = Instance.new("TeleportOptions")
	teleportOptions.ServerInstanceId = game.JobId
	teleportOptions:SetTeleportData(teleportData)
	
	
    local attemptIndex = 0
    local success, result 
    repeat
        success, result = pcall(function()
            return game:GetService("TeleportService"):Teleport(game.PlaceId, { Player }, teleportOptions)
        end)
        attemptIndex += 1
        if not success then
            task.wait(2)
        end
    until success or attemptIndex == 4
end)


game.Players.OnPlayerAdded:Connect(function(Player)
	local JoinData = Player:GetJoinData()
	if JoinData.autoRejoin then
		-- Teleport to afk room
	end
end)

Local

local ReqMins = 17



local RejoinRemote = game.ReplicatedStorage:WaitForChild("RejoinRemote");
local Time = 0
game.Players.LocalPlayer:GetMouse().Move:Connect(function() Time = 0 end)
game:GetService("UserInputService").InputEnded:Connect(function() Time = 0 end)
ReqMins *= 60
while task.wait(1) do
	Time += 1;
	if Time >= ReqMins then
		RejoinRemote:FireServer()
		break
	end
end
6 Likes

what that dude posted up there works

while wait() do
	game:GetService("Players").LocalPlayer.Idled:connect(function()
		game:GetService("VirtualUser"):ClickButton2(Vector2.new())
	end)
end
1 Like
while wait() do
	game:GetService("Players").LocalPlayer.Idled:connect(function()
		game:GetService("VirtualUser"):ClickButton2(Vector2.new())
	end)
end

no one reading above replies, other guy alr solved this

2 Likes

Thanks kylerzong for saving me some effort, so this still works as of Sep 2023 ? You have it in production?

1 Like

Are you sure? Apparently it does not work any longer in a script, only in the command bar?

I get an error “The current thread cannot call ‘ClickButton2’ (lacking capability LocalUser)”

So not sure how it would be working anymore, the poster you quoted posted that in 2019.

1 Like

It does say that it doesnt work very well anymore

1 Like