Prevent AFK timeout

So my game is based on the concept of story writing and role-playing. Going afk is inevitable at some point. Timing out from a large roleplay is really inconvenient and a bummer. I’d like to know if there is a way to make an “AFK” mode which prevents that player from being kicked for inactivity.

17 Likes

If the client doesn’t register any input whatsoever for 20 minutes, it will disconnect itself. There’s no way to circumvent disconnecting as far as I know (apart from, of course, actually giving input every so often).

4 Likes

Maybe every so often in the story line add a button that says “Click to continue” as that would class as an input.

3 Likes

The solution is by no means clean, but it will work. Before the player disconnects, teleport them to another place. In their teleport data include the games JobId, then when a player arrives teleport them back using TeleportToPlaceInstance. There are of course complications that may arise, just ensure you handle these correctly.

12 Likes

Depending on how he has the character/roleplay system set up, wouldn’t this cause the character to have to be remade, unless there’s a seperate saving system for it as well?

1 Like

In my experience people still time out in a cumulative 20 minutes doing that. Furthermore I think it is simply not allowed to circumvent the 20 minute timeout.

1 Like

Peeps in ToM use Ghost clickers to stop themselves from DC’ing to grind that Zen.

5 Likes

AFAIK It’s not possible to cancel the timeout, even through hacky solutions. Even if you do, there is no real use case for allowing players to remain AFK for long periods of time except for cheating to grind points on simulators or time-based games that give rewards depending on how long you stay.

3 Likes

I recommend after around 10 minutes of a character being AFK, get the players CFrame / Backpack / Morph (ect) and save it as a variable. Reload the character (Plr:LoadCharacter()). (You will need to set “CharacterAutoLoads” to false for this to work) After respawning the character simply do:

Player.Character:SetPrimaryPartCFrame(OldCFrame) – // Old CFrame is the variable that contains the players last position.

1 Like

You mean for that function? As that works whether CharacterAutoLoads is enabled or not.

Furthermore I am pretty sure the inactivity is the client tracking user input, moving the character /should/ not affect that whatsoever.

2 Likes

I tend to keep CharaterAutoLoads off when doing repspawning for instant respawn.